将 ngRoute 添加到 angularjs
Add ngRoute to angularjs
我正在使用 angularjs 和 yeoman。我正在尝试将 ngRoute 添加到我的项目中。我用 bower
安装了它
"angular-route": "~1.4.1",
当我尝试在 app.js 中加载它时,出现此错误
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.
确保除了包含 angular.js 之外还包含:
<script type="text/javascript" src="path/to/angular-route.js"></script>
有关安装说明,请参阅 ngRoute API。
需要参考angular-route.js,请找cdnlink如下
<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>
您还可以在以下link中获取angular的最新版本cdn
http://cdnjs.com/libraries/angular.js/1.4.0
我正在使用 angularjs 和 yeoman。我正在尝试将 ngRoute 添加到我的项目中。我用 bower
安装了它"angular-route": "~1.4.1",
当我尝试在 app.js 中加载它时,出现此错误
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.
确保除了包含 angular.js 之外还包含:
<script type="text/javascript" src="path/to/angular-route.js"></script>
有关安装说明,请参阅 ngRoute API。
需要参考angular-route.js,请找cdnlink如下
<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>
您还可以在以下link中获取angular的最新版本cdn http://cdnjs.com/libraries/angular.js/1.4.0