Routing: get notified about parameter updates without reloading the view

偶尔善良 提交于 2019-12-11 10:51:42

问题


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));

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?


回答1:


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



来源:https://stackoverflow.com/questions/21775606/routing-get-notified-about-parameter-updates-without-reloading-the-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!