【发布时间】:2016-12-26 10:17:42
【问题描述】:
我制作<tabset> 视图以显示页面中的内容。我也在使用
Bootstrap's Tabs and Lazy Data Loading 以便特定选项卡的控制器仅在其处于活动状态时才被初始化。我能够实现标签的延迟加载。
<div id="panel" ng-controller="HomeController as hmctrl">
<tabset>
<tab class="nav-item" id="tab_content" title="Tab1" template-url="app/components/tab1/tab1.html"></tab>
<tab class="nav-item" id="tab_content" title="Tab2" template-url="app/components/tab2/tab2.html"></tab>
<tab class="nav-item" id="tab_content" title="Tab3" template-url="app/components/tab3/tab3.html"></tab>
</tabset>
</div>
在我的 app.config 中,我只有一条通往主页的路线
var app = angular.module('myApp', ['bootstrap.tabset','ngRoute']);
app.config(
function($routeProvider,$locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/components/home/homeView.html'
});
});
对于每个选项卡,都有一个单独的控制器分配给它们。
我想知道以这种方式创建时如何将路由分配给任何特定的选项卡。这样我就可以使用$location.path() 函数导航到它们。
我在这里创建了一个 plnkr Plnkr for the above described scenario
【问题讨论】:
标签: javascript jquery angularjs twitter-bootstrap