userController에서 testController의 Listing 함수를 호출하려고합니다. 다음 코드에서 함수를 호출 할 곳을 (//) 표시합니다. 당신이 둥지 마크 업이 두 컨트롤러, 당신은 자식 컨트롤러에서 부모 범위 기능에 액세스 할 수있는 경우 내가 에서이 일을하고는angularjs에있는 다른 컨트롤러에서 한 컨트롤러의 기능을 호출하는 방법은 무엇입니까?
function userController($scope, $http) {
$scope.SignUp = function() {
$http.post('<?php echo site_url('angularjs/addToTable'); ?>', {'uname': $scope.username, 'pswd': $scope.userpassword, 'email': $scope.useremail}
).success(function(data, status, headers, config) {
// Here i want to call Listing function of testController ...
});
}
}
function testController($scope, $http) {
$scope.Listing = function() {
$scope.users = [];
$http.get('<?php echo site_url('angularjs/get_list'); ?>').success(function($data) {
$scope.users = $data;
});
}
}