Angular.js Unknown provider 错误

来源:互联网 发布:人工智能利大于弊 编辑:程序博客网 时间:2024/05/01 05:53
var Todoapp = angular.module("Study", ["ngResource"]).config(function ($routeProvider) {    $routeProvider.        when("/", { controller: ListCtrl, templateUrl: "list.html" }).        otherwise({redirectTo:"/"});});var ListCtrl = function ($scope,$location) {    $scope.test = "testing";}
上面的语句运行时会报Uncaught Error: [$injector:modulerr] Failed to instantiate module Study due to: Unknown provider: $routeProvider

这个错误,需要将 ngResource 改成 ngRoute就可以了


第二个问题:

Uncaught Error: [$injector:modulerr] Failed to instantiate module Study 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 na...<omitted>...1)

这个错误是因为没有引用相应JS:    <script src="Scripts/angular-route.js"></script>

0 0
原创粉丝点击