1.0.2 • Published 9 years ago
middleout-ng-acl v1.0.2
Middleout Angular Router
Resolves no longer accept functions. Instead, they require a string. The string is the name of the service to inject. That service must have a method called "invoke()" which must return a promise if you want to wait for it to respond.
Optionally you can type "SomeService@SomeMethod" to run the SomeMethod instead.
The documentation is that from ngRoute. The only difference is the resolve system and the nested routes.
The resolve services receive the route and params.
The resolve services do not act as a middleware(!). Instead they are all fired at the same time and do not know about each other.
Install
npm install middleout-ng-router
Usage
require('angular');
var Router = require('middleout-ng-router');
app.config(function(RouterProvider){
Router.init({
"routes": {
"base": {
"resolve": {
"auth": "SomeAuthService@CheckAuthBeforeAnyRouteIsMatched"
},
"url": "/"
},
"base.locale": {
"url": "/:locale",
"controller": "SomeController",
"templateUrl": "someView"
},
"base.locale.not-found": {
"url": "/not-found",
"controller": "PageNotFoundCtrl",
"template": "inline template"
}
}
});
Router.otherwise('/not-found');
})
License
Apache 2