이 코드 아래 console.log가 올바르게 작동하고 있습니다. 다른 컨트롤러를 사용하여이 데이터를 다른 페이지로 설정하는 방법.콘솔 데이터를 설정하는 방법
$scope.selectedJsonObject=function(category)
{
console.log(category);
}
이 코드 아래 console.log가 올바르게 작동하고 있습니다. 다른 컨트롤러를 사용하여이 데이터를 다른 페이지로 설정하는 방법.콘솔 데이터를 설정하는 방법
$scope.selectedJsonObject=function(category)
{
console.log(category);
}
당신은 두 개의 컨트롤러를 통해 변수를 공유 할 수 Service
를 사용할 수
angular.module('Shared', []);
angular.module("Shared").factory("myService", function(){
return {sharedObject: {data: "eran" } }
});
angular.module('Shared').controller('MainCtrl', function ($scope, myService) {
$scope.myVar = myService.sharedObject;
});
angular.module('Shared').controller('Secondtrl', function($scope, $http, myService) {
$scope.myVar = myService.sharedObject;
});
작업 App
http://stackoverflow.com/questions/38563874/how-to-set-first-controller-data-another-controller/38564637#38564637 내 질문에 대한 답변입니다. – moni123
@DRK는 앱에 동일하게 적용됩니다. – Sajeetharan
컨트롤러 사이의 통신 서비스를 사용 – brk
http://stackoverflow.com/questions/38563874/how-to-set-first-controller-data-another-controller/38564637 # 38564637 이것은 내 질문과 완전히 같습니다. – moni123