3

I am using angularjs with yeoman. I am trying to add ngRoute to my project. I've install it with bower

"angular-route": "~1.4.1",

and when I try to load it in app.js I get this error

angular.module('myApp', ['ngAnimate', 'ngCookies', 'ngResource', 'ui.router', 'ngSanitize', 'ngTouch','ngRoute'])

Error: [$injector:modulerr] Failed to instantiate module myApp due to: [$injector:modulerr] Failed to instantiate module ngRoute due to: [$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.

3
  • 4
    Did you include script tag in HTML? Commented Jun 17, 2015 at 14:56
  • You need to include the script in your HTML (with all your other scripts) Commented Jun 17, 2015 at 14:57
  • 4
    I assume that the Script has not been added to HTML. Moreover, you arre planning to use ngRoute with ui-router ? Commented Jun 17, 2015 at 14:57

2 Answers 2

5

you need to refer the angular-route.js, pls find the cdn link as follows

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js"></script>

also you can get the latest version cdn for angular in following link http://cdnjs.com/libraries/angular.js/1.4.0

Sign up to request clarification or add additional context in comments.

Comments

3

Make sure that in addition to including angular.js you also include:

<script type="text/javascript" src="path/to/angular-route.js"></script>

See ngRoute API for installation instructions.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.