을 ui.router에 링크 탭을 추가 나는 내 $ stateProvider에 대한 다음과 같은 구성이 있습니다는, 프로그램
$stateProvider
.state("main", { abstract: true, url: "/main", templateUrl: "main.html" })
.state("main.tab1", { url: "/tab1", templateUrl: "tab1.html" })
.state("main.tab2", { url: "/tab2", templateUrl: "tab2.html" })
.state("main.tab3", {
url: "/tab3/{id}",
templateUrl: "tab3.html",
controller: function($scope, $stateParams) {
console.log("ID is " + $stateParams.id)
$scope.id = $stateParams.id;
}
});
나는이 컨트롤러에서 탭으로 주요 내용을 정리 해요 : 이제
<div ng-controller="mainController">
<tabset>
<tab ng-repeat="t in tabs"
heading="{{t.heading}}"
select="go(t.route)"
active="t.active">
</tab>
</tabset>
<h2>View:</h2>
<div ui-view></div>
</div>
을, main.html에서 ng-click 버튼을 통해이 함수를 호출합니다.
$scope.tabs.push({heading: "Tab 3", route: "main.tab3", active: true})
내 의도는 b 새로운 항목을 탭 객체에 푸시 한 다음 $ stateProvider 구성을 통해 새로 생성 된 탭에 내용을로드합니다.
질문은/tab3/1234를 직접 호출하는 것처럼 경로를 통해 매개 변수를 전달할 수 있습니까?