Closed warapitiya closed 8 years ago
Is it possible to use dynamic controller binding like in directives?
Directive example
angular.module('myApp',[]). directive('addIcons', function(){ return { restrict : 'A', scope:{}, controller : "@", name:"controllerName", template:'<input type="button" value="(+) plus" ng-click="add()">' } }). controller("IconsOneCtrl",function($scope){ $scope.add = function(){ alert("IconsOne add "); } }). controller("IconsTwoCtrl",function($scope){ $scope.add = function(){ alert("IconsTwo add "); } });
Have you tried it?
Is it possible to use dynamic controller binding like in directives?
Directive example