路由在我的应用程序的设置如下:路由不离子应用工作
$stateProvider
.state('app', {
url: '',
abstract: true,
template: '<ion-nav-view></ion-nav-view>'
});
$stateProvider
.state('app.todos', {
url: '/home',
views: {
todos: {
templateUrl: 'home.html',
controller: 'TodosCtrl'
}
}
});
$stateProvider
.state('app.help', {
url: '/help',
views: {
help: {
templateUrl: 'help.html'
}
}
});
$urlRouterProvider.otherwise('/home');
//index.html
<body>
<ion-nav-bar class="bar-positive"> </ion-nav-bar>
<ion-tabs class="tabs-positive">
<ion-tab icon="ion-checkmark" ui-sref="app.todos">
<ion-nav-view name="todos"></ion-nav-view>
</ion-tab>
<ion-tab icon="ion-help" ui-sref="app.help">
<ion-nav-view name="help"></ion-nav-view>
</ion-tab>
</ion-tabs>
<script type="text/ng-template" id="home.html">
<ion-view title="Todos">
<ion-content padding="true">
<h2>Home Page</h2>
<p>Here's the main route for the app.</p>
</ion-content>
</ion-view>
</script>
<script type="text/ng-template" id="help.html">
<ion-view title="Help">
<ion-content padding="true">
<h2>Using the app</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facilis architecto hic officia quasi excepturi sequi deleniti maiores consectetur veritatis sint?</p>
</ion-content>
</ion-view>
</script>
</body>
在应用程序的开始,我希望国家app.todos到变为活动并显示相应的模板。
这没有发生。
Plnkr可在这里: http://plnkr.co/edit/LDNLHx?p=preview
如何链接到这条路线?我以为我注意到了一个无效的锚标签...你能告诉我们链接到朋友页面的代码吗? – Makoto
不确定您是否打开了正确的plnkr – runtimeZero
继续并在此发布您的tabs.html文件,我会告诉你我的意思。 – Makoto