dart-archive / angular.dart.tutorial

AngularDart tutorial
MIT License
234 stars 89 forks source link

[Tutorial Chapter6] Leave event and view lost #107

Closed RomainN closed 10 years ago

RomainN commented 10 years ago

Hi guys,

With some co-worker, we try to do the chapter 6 of angular tutorial (https://github.com/angular/angular.dart.tutorial/). And we have a weird problem. After some searches, we think about an angular bug. Here is our problem:

When we try to block the leave event in the add view, we lost the view (in the picture, you can see we are alway on the add route but the view has disappeared)

Here is the route code:

void recipeBookRouteInitializer(Router router, ViewFactory views) { views.configure({ 'add': ngRoute( path: '/add', view: 'view/addRecipe.html',

    leave: (RouteLeaveEvent e) {
      e.allowLeave(new Future.value(false));
    }),
'recipe': ngRoute(
    path: '/recipe/:recipeId',
    mount: {
      'view': ngRoute(
          path: '/view',
          view: 'view/viewRecipe.html'),
      'edit': ngRoute(
          path: '/edit',
          view: 'view/editRecipe.html'),
      'view_default': ngRoute(
          defaultRoute: true,
          enter: (RouteEnterEvent e) => 
              router.go('view', {},
                  startingFrom: router.root.getRoute('recipe'),
                  replace: true))
    })

}); }

What wrong with it ?

Thanks for your help. add route

kwalrath commented 10 years ago

@RomainN Is the only thing you changed from the Chapter 6 adding the leave: callback?

@mhevery do you have any ideas about this?

kwalrath commented 10 years ago

@RomainN Since this isn't really a tutorial bug, I think the right way to go is to make a minimal reproducible case, write it up very clearly, and file a bug at https://github.com/angular/angular.dart/issues?milestone=12&state=open.

RomainN commented 10 years ago

No, all the rest is ok and works fine.