Akin Dönmez
Akin Dönmez

Reputation: 363

ng Route with typescript

I m getting this error , any ideas why ?

"Uncaught Error: [$injector:nomod] Module 'route' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument."

i dont understand really. I reqister my modules

module.requires.push("ngRoute");
module.requires.push("route");

    angular.module('route') // create new Angular Module
                    .config(['$routeProvider', function ($routeProvider: angular.route.IRouteProvider) {
                        $routeProvider.otherwise('/');

                        $routeProvider
                            .when('tlob', {
                                templateUrl: 'partial/layout.html'
                            })
  }]);

And at the top of the page i have

///<reference path="../../typings/tsd.d.ts"/>
/// <reference path="../../typings/angularjs/angular-route.d.ts" />

Upvotes: 1

Views: 602

Answers (1)

Brocco
Brocco

Reputation: 65043

Your issue is on this line:

angular.module('route') // create new Angular Module

This will not create a module only refer to an existing one by name. If you want to create a module here you will need to supply an array of other modules to reference (even if it is empty). Try this:

angular.module('route', []) // create new Angular Module

and to take it further since you are using ngRoute:

angular.module('route', ['ngRoute']) // create new Angular Module

Upvotes: 1

Related Questions