I tried passing the form value to one module to another module in angularjs. using a value that works fine.
working: -
var app = angular.module('app', []);
app.value('movieTitle', 'The Matrix');
var app1 =angular.module('app1', ['app']);
app1.controller('MyController', function (movieTitle) {
console.log(movieTitle)
})
Does not work: -
var app = angular.module('app', []);
app.value('movieTitle', 'The Matrix');
app.controller('MyController', function (movieTitle) {
movieTitle = "The Matrix Reloaded";
})
var app1 =angular.module('app1', ['app']);
app1.controller('MyController', function (movieTitle) {
console.log(movieTitle)
})
In the second example, I tried to update the value corresponding to its updating. but while I access the value from another module, at this time it shows only the old value, not updated, someone can help me. where am I wrong ...
source
share