javascript - angular js $broadcast not working -
can tell me wrong bellow code. taking value input box , trying broadcast controller on button click
var myapp = angular.module('myapp',[]); myapp.controller('firstcontroller',function ($scope){ $scope.setvalue = function(){ console.log ($scope.input); $scope.$broadcast ('senddata',{textdata:$scope.input}); } }); myapp.controller('secondcontroller',function ($scope){ $scope.$on ('senddata',function(event,args){ console.log("welcome"); console.log (args.textdata); });
});
Comments
Post a Comment