javascript - 温泉 UI 导航错误 : You can not supply no "ons-page" element to "ons-navigator" when back to first page

标签 javascript angularjs onsen-ui

你好,我是新的温泉用户界面,我的导航有问题,我有这样的应用程序。

  1. start.html :这是第一个页面,我在这个文件中放置了 mynavigator。开始按钮将打开 page1.html
  2. page1.html : 做一些事情会打开 page2.thml
  3. page2.html : 做一些事情会打开 report.html
  4. 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/

相关文章:

javascript - 将 jQuery 转换为 Vanilla JS 问题

javascript - Onsen UI - 提交表单问题

javascript - 如何将 "ons-select"的值保存到 JavaScript 的变量中?

angularjs - 使用 $http 和 $q 获取数据

javascript - 如何在 Angular JS 中创建服务?

javascript - 从 Mongoose 结果匿名函数返回父函数

javascript - 不使用任何内置函数 trim 字符串左侧的空白

javascript - DataTables:获取匹配单列条件的整行的源数据

javascript - AngularJS 在指令模板中使用 Canvas

javascript - 无法获取AngularJs中的数据