저는 components가있는 angularjs 앱이 있으며 ui.router를 사용하여 다른 뷰의 하위 뷰를 추가하려고합니다. 나는 정직하게 ui.router가 구성 요소를 완전히 지원한다고 생각하지 않습니다. 이것은 upcomping 1.0 버전에서 발생할 수 있습니다. 그러나 한편으로 디스플레이 뷰를 동적으로 사용하기 위해 할 수있는 일은 무엇입니까?각도 구성 요소가있는 동적 중첩 뷰
(function() {
'use strict';
function ChatController($scope, $element, $attrs, $firebaseArray) {
var ctrl = this;
console.log("it works");
}
angular.module('myapp').component('chat', {
templateUrl: '/app/component/project/chat.html',
controller: ChatController
});
})(window.angular);
하고 난 projectDetails에서보기를 추가했습니다 :
이
내 $의 stateProvider는$stateProvider
.state('home', {
url :'/home',
template :'<home></home>'
})
.state('projects', {
url:'/projects',
template: "<project-list></project-list>"
})
.state('projectDetails',{
url:'/:projectId',
template : '<project-detail projectDetails="projectDetails"></project-detail>'
, views :{
'chat':{
template : '<chat></chat>'
}
}
});
$urlRouterProvider.otherwise('home');
내가이 방법으로 구성 요소를 만들었습니다 (난 내 시도를했던)한다
<div ui-view="chat"></div>
라우터에는 중첩 된 상태가 있습니다. 사용 해본 적이 있습니까? – Raghu
OP는 분명히 그가 ui-router가 구성 요소를 지원하는지 알지 못합니다. 그래도 ngRoute가 작동하는지 확인할 수 있습니다. –
나는 ui.router 문서를 이미 시험해 보았지만 작동하지 않습니다. 하위 상태를 정의하고 필요에 따라 ui-view 태그를 추가하고 $ state.go ('substate')를 추가하십시오. – David