Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从ng change函数调用ng click函数_Javascript_Angularjs - Fatal编程技术网

Javascript 从ng change函数调用ng click函数

Javascript 从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

我是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-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
}