How pass values between controllers with a factory?
问题 I'm trying to pass data between (I think) two child controllers. Trying to do this with a factory. testFactory.js app= angular.module('testApp'); app.factory('values', [function () { var testValues= { valueA: '' }; return { setValueA: function(a) { testValues.valueA= a; }, getValueA: function() { return testValues.valueA; } }; }]); In different JS files so different controllers. controller1.js (this one sets the value) angular.module('testApp') .controller('firstCtrl', ['$scope''values',