`
lan13217
  • 浏览: 498069 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

Failed to instantiate module [$injector:unpr] Unknown provider: $routeProvider

 
阅读更多
http://stackoverflow.com/questions/18481863/failed-to-instantiate-module-injectorunpr-unknown-provider-routeprovider
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">
API Reference

You also have to add ngRoute as a dependency for your application:

var app = angular.module('MyApp', ['ngRoute', ...]);
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', ...]);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics