0
我是ng的新手。在這裏,我有一個場景,我需要從其他控制器收到成功的響應。我已經嘗試了下面的代碼,但我無法實現我的目標。如何從一個ng控制器到另一個控制器採用這個resposne
CODE:
$scope.received = function(){
$http({
url : "/generic/getdata",
method : 'GET',
}).success(function(data) {
//The data received here I need t take to mydataController
$location.path('/success');
})
when('/success', {
templateUrl: 'ngtemplates/success/success.html',
controller: 'mydataController'
}).
app.controller('mydataController',
[ '$scope', '$http',function($scope, $http,$location) {
//I want the success data here in some function
}]);
請幫我