我知道这适用于ng-click,但它似乎不适用于ng-submit。这就是我要做的事情
ng-submit="methodA(); methodB();"
答案 0 :(得分:1)
是可能的检查示例here
angular.module('submitExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.list = [];
$scope.text = 'hello';
$scope.a = function(){
alert(0);
}
$scope.submit = function() {
if ($scope.text) {
$scope.list.push(this.text);
$scope.text = '';
}
};
}]);
标记:
<form ng-submit="submit(); a()" ng-controller="ExampleController">
Enter text and hit enter:
<input type="text" ng-model="text" name="text" />
<input type="submit" id="submit" value="Submit" />
<pre>list={{list}}</pre>
</form>
答案 1 :(得分:0)
ng-submit="methodA(); methodB();"