이 문제는 다음 states
에서 봐 주시기 바랍니다 설명하기 :
.state('app.play.lobby', {
url: '/lobby',
resolve: {
games: function (FirebaseAdapter) {
return FirebaseAdapter
.syncArray('disciplines')
.$loaded()
.then(function (list) {
return list;
});
},
tournaments: function (FirebaseAdapter) {
return FirebaseAdapter
.syncArray('tournaments')
.$loaded()
.then(function (list) {
return list;
});
}
},
views: {
filter: {
templateUrl: 'play/lobby/filter.tpl.html',
controller: LobbyFilterController
},
browser: {
templateUrl: 'play/lobby/browser.tpl.html',
controller: LobbyBrowserController
}
}
});
모든 것이 잘 작동한다. 문제는 : 컨트롤러 LobbyFilterController
에서 나는 객체 변경을 듣기 위해 $scope.$watch()
을 사용하고 있습니다. 그러나 $watch()
명령이 성공적으로 실행 된 후에는 상태가 성공적으로로드 된 후입니다. 상태가로드되고 객체 안의 속성 값을 변경하면 아무 일도 일어나지 않습니다.
LobbyFilterController
function LobbyFilterController($scope, games, TournamentFilter) {
$scope.filter = {
game: null,
mode: 'regular',
type: 'all',
format: 'all',
eliminationMode: 'all',
gridsize: 'all',
status: 'all',
groupstage: false,
reshuffledGrid: false,
password: false
};
$scope.$watch($scope.filter, function(data) {
console.log('filter changed...');
}, true);
}
이 문제는 내가 같은 $ scope.myVar로 정상적인 값을 사용하려고 할 때 변경되지 않습니다. 로드 후 이벤트가 한 번 발생하므로 실수하지 않았 음을 알았습니다 (잘못하면 틀 렸습니다).
그리고 API를 신중하게 읽은 것 같습니다. 감사합니다. – Fortuna
@ 벤자민 당신을 진심으로 환영합니다. – PSL