Can't get Angular Dart Router to work

Posted by JesterXL on Stack Overflow See other posts from Stack Overflow or by JesterXL
Published on 2014-06-07T03:20:39Z Indexed on 2014/06/07 3:24 UTC
Read the original article Hit count: 237

Filed under:
|
|

I've tried this syntax in AngularDart 0.11.0: Angular Dart passing data from route service into a controller

module.value(RouteInitializerFn, configureRoutes);

void configureRoutes(Router router, RouteViewFactory views)
{
    print("configureRoutes");
    views.configure({
        'login': ngRoute(
            path: '/login',
            view: 'login/login.tpl.html'),
        'today': ngRoute(
            path: '/today',
            view: '/today/today.tpl.html')
});

However, my routing function never seems to get called. I've used both a print statement and breakpoint to no avail. When I attempt to call it like so:

WorkoutLoggerApplication(this.rootScope, this.router)
{
    print("WorkoutLoggerApplication::constructor");
    new Future.delayed(new Duration(seconds: 2), ()
        {
            router.go("login", {});
        });
}

I get:

Bad state: Invalid route name: login

I've tried 0.10.0, but no dice. I've also tried 3 varieties of the new bind function format, both also don't seem to ever fire the routing function.

© Stack Overflow or respective owner

Related posts about angularjs

Related posts about dart