1

I am using below piece of code in my JS file:

var mainAngular = angular.module('baniyaApp', ['ngRoute','ui.bootstrap']);

////======================== CONFIG =================================
mainAngular.config(function($routeProvider, $locationProvider) {
alert('ng route');
$routeProvider
        .when('/', {
            templateUrl: "HomeLandPage.html"
        });
});
////=================================================================

"HomeLandPage.html" exists at the same location, so no issue with the path. The main page that contains ng-view in it.I have taken care of using angular.js file from http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.js link.

I am getting the below error on the console. Please confirm that the JavaScript file is correct.

Uncaught Error: [$injector:modulerr] Failed to instantiate module baniyaApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngRoute due to:
Error: [$injector:nomod] Module 'ngRoute' 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.
2

1 Answer 1

2

You need to include angular-routes.js after including angular.js in your app directory and html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.