how to passing data from one controller to another controller using angular js 1

后端 未结 4 1910
予麋鹿
予麋鹿 2020-12-22 05:14

hi all i using angular js i need to transfer the value from one page controller to another page controller and get that value into an a scope anybody help how to do this

4条回答
  •  萌比男神i
    2020-12-22 05:56

    You can use $rootScope instead of $scope:

    // do not forget to inject $rootScope as dependency
    $rootScope.Message="Hi welcome";
    

    But the best practice is using a service and share data and use it in any controller you want.

提交回复
热议问题