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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -