路由:无需重新加载视图即可获得有关参数更新的通知 [英] Routing: get notified about parameter updates without reloading the view

查看:28
本文介绍了路由:无需重新加载视图即可获得有关参数更新的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次尝试在 Angular 中进行路由,但到目前为止它有效
(欢迎提出改进建议)

This is my first attempt with routing in Angular but it works so far
(suggestions for improvement are welcome)

  call(Router router, ViewFactory views) {
    router.root
    ..addRoute(
        name: 'form',
        path: '/:entityId/form/:recId',
        enter: views('view/dynamic_form.html')
        )
    ..addRoute(
        name: 'table',
        path: '/:entityId/table/:recId',
        enter: views('view/dynamic_table.html')
        )
    ..addRoute(
        name: 'default_view',
        defaultRoute: true,
        enter: (_) =>
            router.go('form',
                {
                  'entityId': '',
                  'rec': '-1'
                },
                replace: true));

到目前为止这工作正常,但是当我点击一个链接只改变recId但保持在同一个视图中(例如view/dynamic_form.html)时,视图仍然会重新加载,这会导致视图出现烦人的(虽然非常简短)消失/出现.

This works fine so far, but when i click a link that changes only the recId but stays in the same view (e.g. view/dynamic_form.html) the view gets still reloaded which results in an annoying (very brief though) disappear/appear of the view.

是否可以在不重新加载视图的情况下获得有关参数更新的通知?

推荐答案

它是 TODO 列表中的用例之一:https://github.com/angular/route.dart/issues/1

It is one of the use-cases on the TODO list: https://github.com/angular/route.dart/issues/1

这篇关于路由:无需重新加载视图即可获得有关参数更新的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆