Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
150 views
in Technique[技术] by (71.8m points)

javascript - AngularJS 1.2 $注入器:modulerr(AngularJS 1.2 $injector:modulerr)

When using angular 1.2 instead of 1.07 the following piece of code is not valid anymore, why?(当使用角度1.2而不是1.07时,下面的代码不再有效,为什么?)

'use strict'; var app = angular.module('myapp', []); app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider. when('/', { templateUrl: 'part.html', controller: 'MyCtrl' }). otherwise({ redirectTo: '/' }); } ]); the issue is in the injector configuration part (app.config):(问题出在注入器配置部分(app.config):) Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.0rc1/$injector/modulerr?p0=muninn&p1=Error%…eapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.0rc1%2Fangular.min.js%3A31%3A252) If I remember correctly this issue started with angular 1.1.6.(如果我没记错的话,这个问题始于angular 1.1.6。)   ask by Dawid translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem was caused by missing inclusion of ngRoute module.(该问题是由于缺少ngRoute模块的包含而引起的。)

Since version 1.1.6 it's a separate part:(从版本1.1.6开始,它是一个单独的部分:) <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script> var app = angular.module('myapp', ['ngRoute']);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...