Just starting out with angularjs and I have a question.
I am currently using single select and I want to retrieve the value selected and based on that value, perform an action. For example, if the value is "DELETE" then I would like to trigger the ng-click function called delete. Below is my code:
index.html
<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>
script.js
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);
//here I will fetch some ids which will be sent to another click function
};
So I am utilizing ng-click function separately for each action and aiming to use them within ng-change to trigger ng-click.