• <bdo id='5Bu9i'></bdo><ul id='5Bu9i'></ul>

      1. <tfoot id='5Bu9i'></tfoot>

      2. <legend id='5Bu9i'><style id='5Bu9i'><dir id='5Bu9i'><q id='5Bu9i'></q></dir></style></legend>

        <i id='5Bu9i'><tr id='5Bu9i'><dt id='5Bu9i'><q id='5Bu9i'><span id='5Bu9i'><b id='5Bu9i'><form id='5Bu9i'><ins id='5Bu9i'></ins><ul id='5Bu9i'></ul><sub id='5Bu9i'></sub></form><legend id='5Bu9i'></legend><bdo id='5Bu9i'><pre id='5Bu9i'><center id='5Bu9i'></center></pre></bdo></b><th id='5Bu9i'></th></span></q></dt></tr></i><div id='5Bu9i'><tfoot id='5Bu9i'></tfoot><dl id='5Bu9i'><fieldset id='5Bu9i'></fieldset></dl></div>

        <small id='5Bu9i'></small><noframes id='5Bu9i'>

      3. Angular ui-router:您可以在不更改 URL 的情况下更改状态吗?

        时间:2023-09-30

          <legend id='N6Mfn'><style id='N6Mfn'><dir id='N6Mfn'><q id='N6Mfn'></q></dir></style></legend>
            <tbody id='N6Mfn'></tbody>
          <tfoot id='N6Mfn'></tfoot>

            <i id='N6Mfn'><tr id='N6Mfn'><dt id='N6Mfn'><q id='N6Mfn'><span id='N6Mfn'><b id='N6Mfn'><form id='N6Mfn'><ins id='N6Mfn'></ins><ul id='N6Mfn'></ul><sub id='N6Mfn'></sub></form><legend id='N6Mfn'></legend><bdo id='N6Mfn'><pre id='N6Mfn'><center id='N6Mfn'></center></pre></bdo></b><th id='N6Mfn'></th></span></q></dt></tr></i><div id='N6Mfn'><tfoot id='N6Mfn'></tfoot><dl id='N6Mfn'><fieldset id='N6Mfn'></fieldset></dl></div>
              • <small id='N6Mfn'></small><noframes id='N6Mfn'>

                  <bdo id='N6Mfn'></bdo><ul id='N6Mfn'></ul>

                  本文介绍了Angular ui-router:您可以在不更改 URL 的情况下更改状态吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  ui-router多个嵌套视图 功能非常好 - 您可以轻松地从应用的一个 状态 跳转到另一个.

                  The multiple nested views functionality of the ui-router is very nice - you can easily jump from one state of your app to another.

                  有时您可能想更改 URL,但有时不想.我觉得 state 的概念应该与 routing 分开/可选.

                  Sometimes you might want to change the URL, but sometimes not. I feel like the concept of state should be separate/optional from routing.

                  这是一个 plunker,说明了我的意思. 这是 ui-router 文档,有 2 处小改动如下:

                  Here's a plunker that shows what I mean. This is a fork of one of the plunkers in the ui-router documentation, with 2 minor changes noted below:

                  .state('route1', {
                          url: "/route", // <---- URL IS SHARED WITH ROUTE2
                          views: {
                              "viewA": {
                                  template: "route1.viewA"
                              },
                              "viewB": {
                                  template: "route1.viewB"
                              }
                          }
                      })
                      .state('route2', {
                          url: "/route", // <---- URL IS SHARED WITH ROUTE1
                          views: {
                              "viewA": {
                                  template: "route2.viewA"
                              },
                              "viewB": {
                                  template: "route2.viewB"
                              }
                          }
                      })
                  

                  这似乎有效 - URL 保持不变.同样,这里做了多少冗余工作?这是经过批准/测试的用法吗?

                  This seems to work - the URL stays the same. Again, how much redundant work is done here? Is this an approved/tested usage?

                  如果您可以从状态中省略 url 那就太好了..

                  It would be nice if you could omit the url from a state..

                  更新问题:这是经过批准/测试的用法吗?

                  Update question: Is this an approved/tested usage?

                  推荐答案

                  你绝对可以拥有一个没有 URL 的状态.事实上,您所在的州都不需要 URL.这是设计的核心部分.话虽如此,我不会做你上面做的.

                  You can absolutely have a state without a URL. In fact, none of your states need URLs. That's a core part of the design. Having said that, I wouldn't do what you did above.

                  如果您希望两个状态具有相同的 URL,请创建一个 抽象父状态,为其分配一个 URL,并使其两个状态成为它的子状态(任何一个都没有 URL).

                  If you want two states to have the same URL, create an abstract parent state, assign a URL to it, and make the two states children of it (with no URL for either one).

                  这篇关于Angular ui-router:您可以在不更改 URL 的情况下更改状态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:基于 API Ajax 调用的 slug 的 Angular UI-Router 动态路由.基于 slug 加载视图 下一篇:对 console.log 的连续调用会产生不一致的结果

                  相关文章

                  <tfoot id='YLbdx'></tfoot>
                  <legend id='YLbdx'><style id='YLbdx'><dir id='YLbdx'><q id='YLbdx'></q></dir></style></legend>
                • <small id='YLbdx'></small><noframes id='YLbdx'>

                  1. <i id='YLbdx'><tr id='YLbdx'><dt id='YLbdx'><q id='YLbdx'><span id='YLbdx'><b id='YLbdx'><form id='YLbdx'><ins id='YLbdx'></ins><ul id='YLbdx'></ul><sub id='YLbdx'></sub></form><legend id='YLbdx'></legend><bdo id='YLbdx'><pre id='YLbdx'><center id='YLbdx'></center></pre></bdo></b><th id='YLbdx'></th></span></q></dt></tr></i><div id='YLbdx'><tfoot id='YLbdx'></tfoot><dl id='YLbdx'><fieldset id='YLbdx'></fieldset></dl></div>
                    • <bdo id='YLbdx'></bdo><ul id='YLbdx'></ul>