Error: [$injector:unpr] angular.js
首先去看控制器是否存在错误
(function () {
angular.module('myApp.demo', [])
.controller('demoCtrl', ['$scope', '$rootScope', function ($scope, $rootScope) {
//your code
}])
})();
例如:
(function () {
angular.module('myApp.demo', [])
.controller('demoCtrl', ['$scope', '$rootScope','PopInfo', function ($scope, $rootScope) {
//your code
}])
})();
会报错:
就可以知道错误是出现在PopInfo上,可能是没有书写正确,正确应为:
.controller('demoCtrl', ['$scope', '$rootScope','PopInfo', function ($scope, $rootScope, PopInfo) {
否则就是项目中不存在 PopInfo
第二种情况是错误出现在HTML页面,比如使用了一个不存在的过滤器T会报错:
正确写法应该在控制器中
.controller('demoCtrl', ['$scope', '$rootScope','T', function ($scope, $rootScope, T) {
然后再使用
Error: [$injector:unpr] angular.js的更多相关文章
- angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testServe
angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testSer ...
- Angular.js中的$injector服务
一 .angular中的依赖注入 angular的一个很重要的特性就是依赖注入,可以分开理解这4个字. 1.依赖: angular里面的依赖,有angular默认提供的,也有我们自己添加的.默认提供的 ...
- Atitit.angular.js 使用最佳实践 原理与常见问题解决与列表显示案例 attilax总结
Atitit.angular.js 使用最佳实践 原理与常见问题解决与列表显示案例 attilax总结 1. 本文范围 1 2. Angular的优点 1 2.1. 双向数据绑定 1 2.2. dsl ...
- Angular JS中的依赖注入
依赖注入DI angularjs中与DI相关有angular.module().angular.injector(). $injector.$provide. DI 容器3要素:服务的注册.依赖关系的 ...
- 秒味课堂Angular js笔记------Angular js中的工具方法
Angular js中的工具方法 angular.isArray angular.isDate angular.isDefined angular.isUndefined angular.isFunc ...
- angular.js使用ui-router注入报错,这里是版本问题导致的
报错如下: common.ts:604Uncaught SyntaxError: Unexpected token ) stateEvents.ts:211Uncaught SyntaxError: ...
- angular.js的依赖注入解析
本教程使用AngularJS版本:1.5.3 angularjs GitHub: https://github.com/angular/angular.js/ Angula ...
- angular js module 的理解
module其实就是一个容器,里面可以装controller,service,directive,filter等, 官网的解释是:Module :A container for the differe ...
- Angular JS - 5 - Angular JS 模块和控制器
1.引入 1.5版本的angularjs,直接打印angular对象: --> <!DOCTYPE html> <html> <head lang="en ...
随机推荐
- Spring下载
Spring官网改版后找了好久都没有找到直接下载Jar包的链接,下面汇总些网上提供的方法,亲测可用. 1.直接输入地址,改相应版本即可:http://repo.springsource.org/lib ...
- ti processor sdk linux am335x evm setup.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm setup.sh hacking # 说明: # 本文主要对TI的sdk中的setup.sh脚本进行解读 ...
- noip2008提高组题解
第一题:笨小猴 模拟 第二题:火柴棒等式 搜索 深搜不用说,确定出两个加数然后判断能否拼出等式. 枚举确实不太好搞,因为枚举范围不确定,太大了容易超时,太小了容易漏解.不过这题的数据貌似很温和,我 ...
- 用实例分析H264 RTP payload
用实例分析H264 RTP payload H264的RTP中有三种不同的基本负载(Single NAL,Non-interleaved,Interleaved) 应用程序可以使用第一个字节来识别. ...
- 【JS】js获得下拉列表选中项的值和id
function tijiao(){ var elem = document.getElementById("dish_sort"); var index=elem.selecte ...
- Informatica 9.1常用查询
select a.mapping_name, a.mapping_id, a.subject_id, a.is_valid, b.pv_precision, c.pv_value, b.pv_defa ...
- SPFile的使用
转:http://blog.csdn.net/pclzr/article/details/7591741 SPFile对应于SharePoint对象模型中的文件,它的使用方法与SPFolder类大致相 ...
- Android-给另一个Activity传递HashMap
I have a HashMap which I would pass to another Activity class. I simply use this code: Intent intent ...
- Binary Tree Level Order Traversal java实现
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- android Vibrator 使用
private Vibrator vibrator; 取得震动服务的句柄 vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); 或者 vi ...