问题描述
我在从AngularJS 1.0.7 升级到 1.2.0rc1 收到此错误。
I received this error upon upgrading from AngularJS 1.0.7 to 1.2.0rc1.
推荐答案
该ngRoute模块的核心是 angular.js
文件不再一部分。如果您继续使用$ routeProvider那么你现在需要在HTML 角route.js
:
The ngRoute module is no longer part of the core angular.js
file. If you are continuing to use $routeProvider then you will now need to include angular-route.js
in your HTML:
<script src="angular.js">
<script src="angular-route.js">
您还必须添加 ngRoute
为您的应用程序的依赖关系:
You also have to add ngRoute
as a dependency for your application:
var app = angular.module('MyApp', ['ngRoute', ...]);
相反,如果你正在使用 角UI路由器
或类似然后就从你的模块删除 $ routeProvider
依赖的.config()
并用它替换与选择的相关供应商(如 $ stateProvider
)。然后,您可以使用 ui.router
相关性:
If instead you are planning on using angular-ui-router
or the like then just remove the $routeProvider
dependency from your module .config()
and substitute it with the relevant provider of choice (e.g. $stateProvider
). You would then use the ui.router
dependency:
var app = angular.module('MyApp', ['ui.router', ...]);
这篇关于无法实例化模块[$喷油器:unpr]未知提供商:$ routeProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!