2016-12-17 57 views
0

我在模態中使用的是AngularJS中的file input of jasny-boostrap,所以我也使用了jasny-bootstrap-angular。我有兩個疑問:將數據傳遞給Angular-Jasny-Bootstrap

  1. 當我點擊按鈕打開模型,我能夠選擇然後我想要的文件。如果我選擇一個文件關閉模型,那麼當我再次打開模型時,該文件將處於數據預覽中,而不是清理。我想在我的angularjs中傳遞null值(或重置)這個圖像預覽(fileinput-preview thumbnail),當我點擊我的按鈕打開模式時;

  2. 如果一個按鈕調用一個模式的點擊,我想自動從我的Web服務到數據previw和自動改變獲取圖像的按鈕「刪除」和「變化」和我得到的圖片服務。

我的HTML:

<div class="fileinput fileinput-new" data-provides="fileinput"> 
<div class="fileinput-preview thumbnail" style="width: 200px; height: 150px;"></div> 
<div> 
<span class="btn btn-primary btn-file"> 
<span class="fileinput-new">Select a image</span> 
<span class="fileinput-exists">Change</span> 
<input type="file" name="file" file-model="fileinput"> <!--compose.myFile--> 
</span> 
<a href="#" class="btn btn-primary fileinput-exists" data-dismiss="fileinput">Remover</a> 
<button class="btn btn-info" ng-click="showInput()">Show Input</button> 
</div> 
</div> 

如果我點擊 '顯示輸入' 我可以看到圖像二值,我用這個angularjs:

$scope.showInput = function() { 
    console.log($scope.fileinput.result); 
} 

我使用這個HTML用我的angularjs代碼來查看來自web服務的圖像,它是一切工作完美的:

<!-- Foto view--> 
<div class="form-group"> 
<img ng-show="equipamento.FotoEquipamento != null" style="height:auto; width:225px;" data-ng-src="{{getImage(equipamento.FotoEquipamento)}}" /> 
</div> 

回答