ion-nav-view 文档的这一部分对我来说没有意义
this part of the ion-nav-view documentation doesn't make sense to me
ion-nav-view 指令的示例代码实际上并未显示其用法。
所以我不确定如何使用它。
这是文档的 link:
http://ionicframework.com/docs/api/directive/ionNavView/
在 USAGE 标题下是这样说的:
on app start, $stateProvider will look at the url, see if it matches
the index state, and then try to load home.html into the
.
Pages are loaded by the URLs given. One simple way to create templates
in Angular is to put them directly into your HTML file and use the
syntax. So here is one way to put
home.html into our app:
<script id="home" type="text/ng-template">
<!-- The title of the ion-view will be shown on the navbar -->
<ion-view view-title="Home">
<ion-content ng-controller="HomeCtrl">
<!-- The content of the page -->
<a href="#/music">Go to music page!</a>
</ion-content>
</ion-view>
</script>
This is good to do because the template will be cached for very fast
loading, instead of having to fetch them from the network.
我是否将所有这些嵌套在 ion-nav-view 指令中?我感到困惑的另一个原因是,在框架提供的其中一个离子模板中,我看到 ion-nav-view 打开和关闭之间没有任何东西(下面的代码是直接从 Ionic 的模板之一复制和粘贴的):
<body ng-app="myApp">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
此 <ion-nav-view>
的行为类似于占位符。您在 templates 文件夹下创建的其他 html 文件放在那里。例如,您的模板文件夹中有 "employees.html"。所以 "employees.html" 的标记看起来像这样:
<ion-view view-title="Employees">
<ion-content>
<ion-list>
<ion-item ng-repeat="item in items">
Hello, {{item}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
以上完成html,将坐"employees.html"。基本上这是将放置在 <ion-nav-view>
标签内的 html。
希望这对您有所帮助。
ion-nav-view 指令的示例代码实际上并未显示其用法。 所以我不确定如何使用它。 这是文档的 link:
http://ionicframework.com/docs/api/directive/ionNavView/
在 USAGE 标题下是这样说的:
on app start, $stateProvider will look at the url, see if it matches the index state, and then try to load home.html into the .
Pages are loaded by the URLs given. One simple way to create templates in Angular is to put them directly into your HTML file and use the syntax. So here is one way to put home.html into our app:
<script id="home" type="text/ng-template">
<!-- The title of the ion-view will be shown on the navbar -->
<ion-view view-title="Home">
<ion-content ng-controller="HomeCtrl">
<!-- The content of the page -->
<a href="#/music">Go to music page!</a>
</ion-content>
</ion-view>
</script>
This is good to do because the template will be cached for very fast loading, instead of having to fetch them from the network.
我是否将所有这些嵌套在 ion-nav-view 指令中?我感到困惑的另一个原因是,在框架提供的其中一个离子模板中,我看到 ion-nav-view 打开和关闭之间没有任何东西(下面的代码是直接从 Ionic 的模板之一复制和粘贴的):
<body ng-app="myApp">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
此 <ion-nav-view>
的行为类似于占位符。您在 templates 文件夹下创建的其他 html 文件放在那里。例如,您的模板文件夹中有 "employees.html"。所以 "employees.html" 的标记看起来像这样:
<ion-view view-title="Employees">
<ion-content>
<ion-list>
<ion-item ng-repeat="item in items">
Hello, {{item}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
以上完成html,将坐"employees.html"。基本上这是将放置在 <ion-nav-view>
标签内的 html。
希望这对您有所帮助。