你好,我是新的温泉用户界面,我的导航有问题,我有这样的应用程序。
- start.html :这是第一个页面,我在这个文件中放置了 mynavigator。开始按钮将打开 page1.html
- page1.html : 做一些事情会打开 page2.thml
- page2.html : 做一些事情会打开 report.html
- report.html :在这个文件中我放了确定按钮,然后我应该回到 start.html
当我使用时:
$scope.myNavigator.pushPage('form/start.html');
//OR
$scope.myNavigator.resetToPage('form/start.html');
所有我得到的错误:
You can not supply no "ons-page" element to "ons-navigator"
如何导航才能返回到 start.html?
最佳答案
您的 start.html
不是真正的 ons-page
。只需将导航器的内容放在不同的文件或 ons-template
中,并确保它包含一个 ons-page
而不是整个 ons-navigator
。如果您希望能够返回到第一页,基本上使用导航器的 page
属性而不是在其中写入内容。如果你可以在 index.html
中编写它,它看起来像这样:
<ons-navigator page="start.html">
</ons-navigator>
<ons-template id="start.html">
<ons-page>
...
</ons-page>
</ons-template>
请注意,ons-template
只能包含在index.html
中。您也可以将该页面写入单独的文件中。希望对您有所帮助!
关于javascript - 温泉 UI 导航错误 : You can not supply no "ons-page" element to "ons-navigator" when back to first page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34056259/