Günter Zöchbauer
Günter Zöchbauer

Reputation: 657781

Routing: get notified about parameter updates without reloading the view

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?

Upvotes: 1

Views: 193

Answers (1)

pavelgj
pavelgj

Reputation: 2701

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

Upvotes: 2

Related Questions