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
}]);
请帮我