AngularJS$injector:unp未知提供程序错误
AngularJS $injector:unpr Unknown Provider Error
我正在尝试创建一个用户配置文件页面。用户可以在其中显示和编辑其信息。
这是我的Controller.js
var userProfileControllers = angular.module("userProfileControllers", []);
userProfileControllers.controller ('userProfileCtrl', ['$scope', '$location', 'localCache', 'customersignup', function ($scope, $location, localCache, customersignup){
var submitProfile = function() {
//Bind Scope
//
var bindScope = function () {
$scope.userProfile = customersignup.userProfile;
};
var asyncBindScope = function() {
$scope.$evalAsync(bindScope());
};
bindScope ();
}}]);
这是我的服务.js
var userProfileServices = angular.module("userProfileServices", []);
userProfileServices.factory("customersignup", function() {
return {
userProfile: {fname: "kunal"},
updateProfile: function() {
var userProfile = this.userProfile;
},
}
});
在HTML中,假设是名字,我在"名字"字段的输入中包含了ng model="userProfile.fname"。现在,当我加载html页面时,我会收到以下错误:-https://docs.angularjs.org/error/$injector/unp?p0=本地缓存提供程序%20%3C-%20localCache%20%3C-%20userProfileCtrl
请查看以上链接,它来自AngularJS官方网站。
检查您是否有两个模块,一个用于service
,另一个用于controller
,请注意,这两个模块之间没有粘合,要实现这一点,您需要粘合这两个模件,为此,将服务模块导入控制器模块,如下所示。
var userProfileControllers = angular.module("userProfileControllers", ['userProfileServices']);
则模块CCD_ 3可以访问定义了哪个服务的模块CCD_。其他情况下,您无法访问服务模块userProfileServices
。
您必须在控制器userProfileServices
中添加工厂名称
相关文章:
- Rails第一个应用程序错误——Errno::ENOENT
- AngularJS:未知的提供程序错误
- webpack:在MacOS上很好,在linux上加载程序错误
- 获取解析值的未知提供程序错误
- React应用程序错误'未捕获的ReferenceError:React未定义'
- IE和GMap API 2包装程序错误
- 无法将节点邮件程序错误响应从节点.js发送到角度.js
- 密钥斗篷未知提供程序错误
- 谷歌浏览器扩展名$.ajax发布事件处理程序错误
- j查询动态事件处理程序错误
- 节点 JS 取消处理程序错误事件
- Chrome 扩展程序和保管箱投放保护程序错误
- 未知提供程序错误 - AngularJS 应用程序问题
- 车把自定义帮助程序错误:“options.fn 不是函数”
- 在 yeoman 中使用动画模块编译 AngularJS 应用程序会给出未知的提供程序错误
- 如何使用 JavaScript 访问 CouchDB?标准操作程序错误
- Angularjs.获取控制器的范围.未知的提供程序错误
- Kendo UI移动滚动程序错误
- Angular js:->访问解析属性时,angular引发未知提供程序错误
- 在遍历光标和更新文档时,连接因应用程序错误而关闭