[英]polymer app-route, how to route to a new page within same App
I am trying to navigate to a new page(ie when i click on a button it should open a new page, within the app) 我正在尝试导航到新页面(即,当我单击按钮时,它将在应用程序中打开一个新页面)
This is first page 这是第一页
<dom-module id="project-view">
<template>
<app-location route="{{route}}" use-hash-as-path></app-location>
<app-route
route="{{route}}"
pattern="/:name"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
<iron-selector selected="[[routeData.name]]" attr-for-selected="data-page">
<a class="btn" data-page="Project" href="#/Project">Go to create project</a>
</iron-selector>
<iron-pages selected="[[routeData.name]]" attr-for-selected="name">
<create-project name="Project" route="{{subroute}}"></create-project>
</iron-pages>
</main>
</div>
<div>
</div>
</template>
<script>
Polymer({
is: 'project-view',
});
</script>
</dom-module>
so now when I click on the button "Go to create project", the create project is opening in the same page, instead of going to a new page. 因此,当我单击“转到创建项目”按钮时,创建项目将在同一页面中打开,而不是转到新页面。 the Url changes to /#/Project but it opens the create-project page just beneath the current page
网址更改为/#/ Project,但它打开了当前页面正下方的创建项目页面
where create-project is just a simple html form page. 其中create-project只是一个简单的html表单页面。 I want to open the create project such that only create-project content appears on the page and not the fusion of previous page content with create-project page
我想打开创建项目,以便仅创建项目内容显示在页面上,而不是将先前页面内容与创建项目页面融合
Can I navigate to create-project ? 我可以导航到创建项目吗? Is there anything I am missing, or is it even possible
我有什么想念的吗,甚至有可能
Polymer's app-route
is designed this way, to work with a "single page app" or SPA. Polymer的
app-route
采用这种方式设计,可与“单页应用程序”或SPA一起使用。 You can create a link or button to show a completely separate page if you like, without the hash. 您可以根据需要创建一个链接或按钮以显示一个完全独立的页面,而不包含哈希。
/my-separate-page
. /my-separate-page
。 But you'll lose everything from memory in your original Polymer based app. 但是,您将失去原始基于聚合物的应用程序中的所有内存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.