Javascript 从ng change函数调用ng click函数
我是angularjs的新手,如果我错了,请澄清我 Im使用single select并希望获取值,并根据值执行操作。例如:如果我将得到“删除”,那么我想将其发送到名为DELETE的ng click函数。下面是我的代码:- html.jspJavascript 从ng change函数调用ng click函数,javascript,angularjs,Javascript,Angularjs,我是angularjs的新手,如果我错了,请澄清我 Im使用single select并希望获取值,并根据值执行操作。例如:如果我将得到“删除”,那么我想将其发送到名为DELETE的ng click函数。下面是我的代码:- html.jsp <body ng-app ng-controller="AppCtrl"> <select ng-model="some_action.type" ng-change="actionchange(some_action.type)" ng
<body ng-app ng-controller="AppCtrl">
<select ng-model="some_action.type" ng-change="actionchange(some_action.type)" ng-options="type.value as type.displayName for type in types">
</select>
</body>
所以我分别使用ng click函数来执行这两个操作,并希望从ng change中调用ng click
function AppCtrl($scope) {
$scope.some_action = {
type: 'Select'
}
$scope.types = [{
value: 'DELETE',
displayName: 'Delete'
},
{
value: 'SUSPEND',
displayName: 'Suspend'
}
]
}
$scope.actionchange = function(value) {
console.log('change action is -' + value);
var fetchIds= [];
// based on the condition push all ids to fetchIDS
$scope.method_Delete(fetchIds);
};
$scope.method_Delete=function(fetchIds){
// do something using fetchIds
}
function AppCtrl($scope) {
$scope.some_action = {
type: 'Select'
}
$scope.types = [{
value: 'DELETE',
displayName: 'Delete'
},
{
value: 'SUSPEND',
displayName: 'Suspend'
}
]
}
$scope.actionchange = function(value) {
console.log('change action is -' + value);
var fetchIds= [];
// based on the condition push all ids to fetchIDS
$scope.method_Delete(fetchIds);
};
$scope.method_Delete=function(fetchIds){
// do something using fetchIds
}