AngularJS : How to create a two-way data binding between two isolated controllers and a shared service?
问题 I am trying to create a two-way data binding between two isolated controllers and a shared service (which provides another isolated scope): app.factory("sharedScope", function($rootScope) { var scope = $rootScope.$new(true); scope.data = "init text from factory"; return scope; }); app.controller("first", function($scope, sharedScope) { $scope.data1 = sharedScope.data; }); app.controller("second", function($scope, sharedScope) { $scope.data2 = sharedScope.data; }); Fiddle: http://jsfiddle.net