angularjs - How to access a function defined in a ui-router state controller -
i have angular ui-router state controller follows.
$stateprovider.state('contacts', { template: '<h1>{{title}}</h1>', controller: function($scope){ $scope.title="mytitle"; $scope.myfunction= function(){ //do }; }, data:{ list:[ { item:"item1", callback:{{myfunction}} } ] } })
as shown in code above, state controller has function attached scope called "myfunction". have directive accesses state. in directive, want call myfunction callback when item1 clicked(i have button corresponding item1 mentioned in data section). please let me know how can call myfunction method directive.
Comments
Post a Comment