我無法找到具有現有答案的解決方案,因此我正在創建新帖子。表單驗證到ng-click指令
我想添加驗證按鈕點擊。
我的情況是這樣,
我有兩個輸入框和一個圖像上載一個形式,在這裏我們有默認的圖像和用戶還可以上傳一個新的機會。 如果用戶未上傳圖片,我們必須在點擊提交後顯示錯誤消息。
<div class="form-group">
<img src="{{ImageUrl}}" class="img-responsive m-b-md" />
<button type="button" class="btn btn-primary-outline btn-xs pull-right dash-post-button" aria-label="Post" ng-click="changeImage()">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
<small>change image</small>
</button>
<span ng-show="errImg">please choose the image</span>
</div>
的上傳圖片:
$scope.iSupportImageUrl = "images/iceland.jpg";
var setiSupportImageUrl = function (iSupportImgId) {
$scope.iSupportImageUrl = AWSBucketNameConverter.getAWSURL('TELEKHA_ISUPPORT_IMG', iSupportImgId);
};
$scope.changeiSupportImage = function() {
var iSupportImgUpldmodalInstance = $modal.open({
controller: 'EventimageuploadCtrl',
templateUrl: 'views/isupportimageupload.html',
animation: true
});
iSupportImgUpldmodalInstance.result.then(
function (result) {
setiSupportImageUrl(result.fileId);
result.status='a';
result.createdTS='2014-05-04';
result.containerName='TELEKHA_ISUPPORT_IMG';
result.createdById=23;
result.createdName='abc';
$scope.newiSupport.bannerImage=result
},
function() {
}
);
};
所以現在有什麼問題?你有什麼內部changeImage – Sajeetharan
@Sajeetharan當我點擊提交它應該顯示錯誤消息,但現在它提交。 – Ajay
只是返回,如果有錯誤 – Sajeetharan