<button type="button" id="submitButton1" name="submitButton1"
class="btn btn-primary waves-effect waves-light"
ng-click = "validateAndSaveData('upload')"
value="Upload Documents" data-target="#myModal1"
data-toggle="modal">Upload
</button>
我正在添加一个函数来验证表单的字段,如果满足所有条件,我希望触发datatarget。
$scope.validateAndSaveData= function(initiatorName,emailId,actionType){
if( angular.isUndefined($scope.requestType)){
alert("Kindly Select Request Type");
$('#requestType').focus();
return false;
}
}
如果此函数返回false,则表示不应触发模型。
答案 0 :(得分:0)
只需通过javascript触发模态
<button type="button" id="submitButton1" name="submitButton1" class="btn btn-primary waves-effect waves-light" ng-click = "validateAndSaveData('upload')" value="Upload Documents" data-target="#myModal1">Upload</button>
和
$scope.validateAndSaveData= function(initiatorName,emailId,actionType){
if( angular.isUndefined($scope.requestType)){
alert("Kindly Select Request Type");
$('#requestType').focus();
} else {
var id = $('#requestType').data('target');
$(id).modal('show');
}
}