路由:获取关于参数更新的通知,而不重新加载视图 [英] Routing: get notified about parameter updates without reloading the view

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

问题描述

这是我第一次尝试在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));

到目前为止这个工作正常,但当我点击链接 / strong>,但保持在同一个视图(例如 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.

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

Is it possible to get notified about parameter updates without reloading 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天全站免登陆