Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

feat(routing): new DSL and deferred module loading #525

Merged
merged 4 commits into from
Feb 7, 2014

Conversation

pavelgj
Copy link
Contributor

@pavelgj pavelgj commented Feb 7, 2014

Introduced new routing DSL that allows adding new modules for views.

        views.configure({
          'foo': ngRoute(
              path: '/foo',
              view: 'foo.html',
              enter: (RouteEnterEvent e) => enterFoo(e),
              mount: {
                'bar': ngRoute(
                    path: '/bar',
                    view: 'bar.html',
                    preEnter: (RoutePreEnterEvent e) => checkIfCanEnterBar(e),
                ),
                'baz': ngRoute(
                    path: '/baz',
                    view: 'baz.html',
                    leave: (RouteLeaveEvent e) => checkIfCanLeaveBaz(e),
                )
              }
          ),
          'aux': ngRoute(
              path: '/aux',
              view: 'foo.html',
              defaultRoute: true
          )
        });

Modules can be loaded synchronously

        views.configure({
          'foo': ngRoute(
              path: '/foo',
              modules: () => [
                new Module()..type(NewDirective)
              ],
              view: 'foo.html'
          ),
        });

or asynchronously, for example in case of deferred library loading:

        views.configure({
          'foo': ngRoute(
              path: '/foo',
              modules: () => new Future.value([
                new Module()..type(NewDirective)
              ]),
              view: 'foo.html'
          ),
        });

Fixes #435

@mhevery
Copy link
Contributor

mhevery commented Feb 7, 2014

Add missing tests, LGTM otherwise.

Introduced new routing DSL that allows adding new modules for views.
Modules can be loaded synchronously or asynchronously, for example in case of deferred library loading.
@pavelgj pavelgj merged commit 3db9ddd into dart-archive:master Feb 7, 2014
@sethladd
Copy link
Contributor

Does this have the viewHtml feature?

@pavelgj
Copy link
Contributor Author

pavelgj commented Feb 11, 2014

@sethladd no. How soon do you need it?

@sethladd
Copy link
Contributor

Sorry, just saw the other updates. I'd love it for AngularDart 1.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

Simplify routing configuration syntax
3 participants