In my angularjs page I am passing a global data to another controller using 
the $rootscope object of angularjs. In my controller i am successfully able 
to catch the value stored in $rootscope object and the value is populating 
correctly and i am using the value in a label contol. But when I am 
refreshing the page the value is getting disappeared . What is the problem 
in this and how cam I overcome this situation.

$scope.loginname = $rootScope.curusername;


I have also tried to manage it using Service by writing the below code.

*Service*

demoapp.factory('DataService', function () {
    var datauser = 'surajit';
    return {
        userdetails: function (name) {
            datauser=name;
        },
        getuserdetails: function () {
           
        }
    };
 
    return {
        data: datauser
        
    };


*In the first controller -*


DataService.data = "SAM";


*In the second controller :*


$scope.loginname = DataService.data;


*In the View :*


 logeed in name2 : {{loginname}}



But first time it is coming after the second time it is disappearing.Pls help



Thanks and regards 

Utpal

-- 
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.

Reply via email to