[英]Pass the JSON Data Between From Controller To another Controller with out using Services or Factory in angular JS while Routing
我在“ Dashboard
頁面中有“對象”,當從“儀表板”中單擊“ Details
頁面”時,它應該重定向到“ Details
頁面,我想將JSON對象從“ Dashboard Controller
傳遞到“ Details Controller
,有沒有辦法Angular JS
Service或factory
。
myApp.controller('dashBoardController', ['$scope', function($scope) {
$scope.detailsPage = function(Object){
// I want this object available in details page controller
$location.path('/detailsPage');
};
}]);
myApp.controller('detailsOageController', ['$scope', function($scope) {
// need Object data here
}]);
您可以通過以下方法實現從一個控制器到另一個控制器的數據共享。
https://docs.angularjs.org/api/ng/type/ $ rootScope.Scope
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.