Как использовать function assigned variable
в ng-click?
?Я пробовал тремя способами ниже, но это тоже не работает.
Не могли бы вы дать мне знать, возможно это или нет ???если да, то как?
var app = angular.module("app", []);
app.controller("name", function($scope) {
$scope.showname = function()
{
alert("Ramesh");
}
$scope.variable1 = $scope.showname;
$scope.variable2 = "showname()";
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="name">
<button type="button" ng-click="variable1" tabindex="10003" >Not working 1 </button>
<button type="button" ng-click="$scope[variable2]()" tabindex="10003" >Not working 2 </button>
<button type="button" ng-click="variable2" tabindex="10003" >Not working 3 </button>
<button type="button" ng-click="showname()" tabindex="10003"> working </button>
</div>