Sample $RouteProvider based on page.js

63 views
Skip to first unread message

Sandy Place

unread,
Feb 21, 2013, 2:00:40 AM2/21/13
to ang...@googlegroups.com
Just learning Angular and javascript and took a first stab at a simple router. This for me was a leaning tool and a proof of concept and by no means production ready.

Some of the features:
  1. Animations
  2. Hierarchical views
  3. Simple fluent syntax for declaring your routes.
  4. Based on lightweight VisionMedia's page.js

```javascript
var app = angular.module('myApp', ['router']);

app.config(function ($routerProvider) {
    $routerProvider.route('/').to(HomeController).using('HomeView.html').renderTo('contents');
    $routerProvider.route('/players*').action(loadPlayers);
    $routerProvider.route('/players').to(PlayersController).using('PlayersView.html');
    $routerProvider.route('/messages').to(MessagesController).using('MessagesView.html');
    $routerProvider.route('*').renderTo('subcontents');
    $routerProvider.route('*').redirectTo('/');
});
```
Below is the github link:


Any feedback is welcome, enjoy,
Sandy Place

Sandy Place

unread,
Feb 21, 2013, 2:01:16 AM2/21/13
to ang...@googlegroups.com
Jeez what a newb. apparently this does not support markdown.
Reply all
Reply to author
Forward
0 new messages