AngularJS UI路由器:导航到选项卡时未注册历史状态(AngularJS UI Router: Not registering history state when navigating to

编程入门 行业动态 更新时间:2024-10-26 07:31:25
AngularJS UI路由器:导航到选项卡时未注册历史状态(AngularJS UI Router: Not registering history state when navigating to tabs)

我有一个Angular应用程序,它使用Angular UI Routing来提供状态。 页面之间的基本路由工作。

该应用有多个页面,其中一个页面有标签。 当我导航到页面时,我得到一个很好的动画,后面的按钮出现在标题中。

但是当我导航到标签页时,后退按钮不会出现,并且页面没有动画。 当我导航到包含选项卡的页面并显示后退按钮时,是否可以获得动画?

更新:做了一个新的例子,更能说明我的意思: http : //plnkr.co/edit/jKII2S3uEnEOVDy9WBA2?p = preview

I have an Angular app that uses Angular UI Routing to provide states. The basic routing between pages works.

The app has multiple pages, and one of those pages has tabs. When I navigate to the page, I get a nice animation, and the back button appears in the header.

But when I navigate to the tabs page, the back button doesn't appear and there is no animation to the page. Is it possible to get an animation when I navigate to the page that has tabs, and to have the back button appear?

UPDATE: Made a new example that better shows what I mean: http://plnkr.co/edit/jKII2S3uEnEOVDy9WBA2?p=preview

最满意答案

看看这个 - http://ionicframework.com/docs/angularjs/controllers/view-state/

视图服务由Ionic的tabs指令利用,该指令具有子选项卡指令。 每个选项卡都需要自己的历史堆栈(前进和后退按钮),为此,每个选项卡都有自己的navView指令。 此系统类似于您在现代应用程序中看到的内容,例如iOS的App Store或Android的Play商店。

选项卡中的每个选项卡都有自己的历史堆栈,因此,当您第一次输入选项卡时,会重置导航栏历史记录。 它在指令范围内使用$ historyId值进行管理。 也许你可以通过使用这些价值来解决这个问题。

look into this - http://ionicframework.com/docs/angularjs/controllers/view-state/

The View Service is leveraged by the Ionic's tabs directive, which has child tab directives. Each tab requires its own history stack (forward and back buttons), and to do so each tab has its own navView directive. This system is similar to what you see in modern apps, such as iOS's App Store, or Android's Play Store.

each tab within tabs has it's own history stack, therefor your nav-bar history is reset when you enter a tab for the first time. it is managed with a $historyId value on the scope of the directive. maybe you can work around that with the use of these value.

更多推荐

本文发布于:2023-07-22 10:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219216.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未注册   路由器   选项卡   状态   历史

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!