ionic 嵌套view 的方法

我一直想在一个页面的同一个 DIV 里面嵌入一个不一样的 HTML文件  ....可是老是没有达到我要的效果.....才发现原来我没有加一个 namehtml

我用angular-ui 插件 里面的样式  老是没有跳转....app

1     <div ui-view></div>
2     <!-- We'll also add some navigation: -->
3     <a ui-sref="state1">State 1</a>
4     <a ui-sref="state2">State 2</a>

在app.js 里面ionic

 1 myApp.config(function($stateProvider, $urlRouterProvider) {
 2   //
 3   // For any unmatched url, redirect to /state1
 4   $urlRouterProvider.otherwise("/state1");
 5   //
 6   // Now set up the states
 7   $stateProvider
 8     .state('state1', {
 9       url: "/state1",
10       templateUrl: "partials/state1.html"
11     })
12  .state('state2', {
13       url: "/state2",
14       templateUrl: "partials/state2.html"
15     })
16 });

或者是这种方法ide

1  <div ui-view="viewA"></div>
2     <div ui-view="viewB"></div>
3     <!-- Also a way to navigate -->
4     <a ui-sref="route1">Route 1</a>
5     <a ui-sref="route2">Route 2</a>

而在app.js 中ui

 1 myApp.config(function($stateProvider) {
 2   $stateProvider
 3     .state('index', {
 4       url: "",
 5       views: {
 6         "viewA": { template: "index.viewA" },
 7         "viewB": { template: "index.viewB" }
 8       }
 9     })
10     .state('route1', {
11       url: "/route1",
12       views: {
13         "viewA": { template: "route1.viewA" },
14         "viewB": { template: "route1.viewB" }
15       }
16     })
17 
 
 

 

24 });

我发现都没有达到我要的效果...url

忽然才发现我错了spa

ionic 比较是改过的...插件

 我便这样作了code

1 <div ui-view name="myadd"></div>
1 .state('tab.mytab1.router1',{
2  url:"/router1",
3 views: {
4 'myadd': {
5 templateUrl: 'addview.html',
6 }
7 }
8 })