node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


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.


npm install middleout-ng-router


var Router = require('middleout-ng-router');
      "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"


Apache 2