Javascript angularjs:ui路由器(嵌套视图)和引导选项卡不好用
我在让ui路由器将片段加载到引导选项卡主体中时遇到问题。我链接了上面的代码示例。如果我错过了什么,请告诉我。我看了10个不同的堆栈溢出示例,其中没有一个帮助解决了我的问题 我有一个外部ui视图,可以很好地加载初始页面片段Javascript angularjs:ui路由器(嵌套视图)和引导选项卡不好用,javascript,html,angularjs,angular-ui-router,Javascript,Html,Angularjs,Angular Ui Router,我在让ui路由器将片段加载到引导选项卡主体中时遇到问题。我链接了上面的代码示例。如果我错过了什么,请告诉我。我看了10个不同的堆栈溢出示例,其中没有一个帮助解决了我的问题 我有一个外部ui视图,可以很好地加载初始页面片段 <div id="view" ui-view></div> {{tab.label} {{tab.label} 您应该这样设置您的状态: $stateProvider /* Main Views */ .st
<div id="view" ui-view></div>
您应该这样设置您的状态:
$stateProvider
/* Main Views */
.state('requestView', {
url: '/requestView',
templateUrl: 'bravo_home.html',
controller: 'requestCtrl'
})
/*Other states here*/
/* Tabs */
.state('requestView.request', {
url: '/request',
templateUrl: 'request-tab.html'
})
.state('requestView.approved', {
url: '/approved',
templateUrl: 'approved-tab.html'
});
然后,在您的bravo_home.html:
请注意,我删除了=“选项卡”。您可以根据需要将控制器添加到嵌套选项卡状态,例如:
// add "controller: 'requestTabCtrl'" to state
.controller("requestTabCtrl", function($scope) {
console.log('Hello Request Tab');
})
// add "controller: 'approvedTabCtrl''" to state
.controller("approvedTabCtrl", function($scope) {
console.log('Hello Approved Tab');
});
您应该这样设置您的状态:
$stateProvider
/* Main Views */
.state('requestView', {
url: '/requestView',
templateUrl: 'bravo_home.html',
controller: 'requestCtrl'
})
/*Other states here*/
/* Tabs */
.state('requestView.request', {
url: '/request',
templateUrl: 'request-tab.html'
})
.state('requestView.approved', {
url: '/approved',
templateUrl: 'approved-tab.html'
});
然后,在您的bravo_home.html:
请注意,我删除了=“选项卡”。您可以根据需要将控制器添加到嵌套选项卡状态,例如:
// add "controller: 'requestTabCtrl'" to state
.controller("requestTabCtrl", function($scope) {
console.log('Hello Request Tab');
})
// add "controller: 'approvedTabCtrl''" to state
.controller("approvedTabCtrl", function($scope) {
console.log('Hello Approved Tab');
});
那对我不起作用。选项卡切换,url更改为/requested或/approved,但没有加载任何内容,片段或控制器也没有加载。谢谢你,乔希,这对我不管用。选项卡切换,url更改为/requested或/approved,但没有加载任何内容,片段或控制器也没有加载。谢谢,乔希