Clear $scope on logout in Angular js

后端 未结 5 1253
深忆病人
深忆病人 2021-01-19 10:59

In my controller I am storing data as $scope.$parent.dossierSummaries = data; but after log out and login the application $scope.$parent.dossierSummaries<

5条回答
  •  一生所求
    2021-01-19 11:48

    in angularJS, you shouldn't set the variable directly to a controller but you should retrieve it from a service instead. So whenever you load a controller you should write a init() function to get value of that model. So everytime you will have the correct data from server.

    Code example and docs : http://docs.angularjs.org/guide/dev_guide.services.creating_services

提交回复
热议问题