Hi,
basically i am creating one spa.which is having two view. one is login
screen and one is detail view.
on login i am setting the property using the service. and inject the
service in both the controller.
at the first time it gives me the corrrect value.but when i refresh the
page then it returns me undefined;
app.controller("login",['$scope',''sharedservice"],function($scope,sharedservice)
{
sharedservice.setBaseUrl('http://172.16.0.201:8090');
}]);
app.controller("detail",['$scope',''sharedservice"],function($scope,sharedservice)
{
$scope.baseurl = sharedservice.getBaseUrl();
// first time it gives the correct value when i refresh the page it returns
undefined
}]);
app.service('sharedservice', function () {
var property = {};
return {
getBaseUrl: function() {
return property.baseUrl;
},
setBaseUrl: function(value) {
property.baseUrl = value;
}
};
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.