Sharing Data Between Controllers, Angularjs 1.3 version -


i working on this jsfiddle, in angularjs 1.2.17
when try same script angularjs 1.3.14 gives error, see console.

finally when try this fiddle again 1.3.14 version:

<div ng-app='app'>     <div ng-controller="firstctrl">         <input type="text" ng-model="data.msg" />          <h1>{{data.msg}}</h1>      </div>     <div ng-controller="secondctrl">         <input type="text" ng-model="data.msg" />          <h1>{{data.msg}}</h1>      </div> </div>  var app = angular.module('app', []);  app.factory('data', function () {     return {         msg: "i data service"     }; }); app.controller('firstctrl', ['$scope', function($scope, data){     $scope.data = data; }]); app.controller('secondctrl', ['$scope', function($scope, data){     $scope.data = data; }]); 

i not make work: not give error data.msg not update in both controller.

what have done wrong?

do not use sensitive keys such data or data not forget include dependencies fiddle


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -