Angularjs BreezeJS EntityManager工厂未知提供程序ASP.NET
我正在将entityManagerFactory注入Angular,但我得到了一个错误。这是在datacontext模块中完成的,就像John Papa的示例一样。错误是未知的。我正在index.html文件中包含entityManagerFactory.js文件,但没有成功。有什么想法吗Angularjs BreezeJS EntityManager工厂未知提供程序ASP.NET,angularjs,breeze,Angularjs,Breeze,我正在将entityManagerFactory注入Angular,但我得到了一个错误。这是在datacontext模块中完成的,就像John Papa的示例一样。错误是未知的。我正在index.html文件中包含entityManagerFactory.js文件,但没有成功。有什么想法吗 function () { 'use strict'; var serviceId = 'datacontext'; angular.module('app').factory(se
function () {
'use strict';
var serviceId = 'datacontext';
angular.module('app').factory(serviceId, ['common', 'entityManagerFactory', 'breeze', 'logger', datacontext]);
function datacontext(common) {
var $q = common.$q;
var service = {
getPeople: getPeople,
getMessageCount: getMessageCount
};
}
}
如果您使用HotTower.Angular.Breeze 2.2.0版启动了一个新项目,那么您面临的问题实际上可能是entityManagerFactory注入的BreezeProvider的问题 如果是这种情况,您应该看到错误:
未知提供者:breezeProvider我也有同样的错误,解决方案很简单,并记录在John Papas的博客中 在index.html文件中,确保您有对所有必需源文件的引用,并且它们以正确的顺序加载
<link href="content/breeze.directives.css" rel="stylesheet" />
<script src="scripts/breeze.debug.js"></script>
<script src="scripts/breeze.angular.js"></script>
<script src="scripts/breeze.directives.js"></script>
<script src="scripts/breeze.saveErrorExtensions.js"></script>
<script src="scripts/breeze.to$q.shim.js"></script> <!-- Needed only if you are using to$q -->
<script src="app/app.js"></script>
...
...
<script src="app/services/entityManagerFactory.js"></script>
抓住罗杰。因为我是从Nuget的一个空白热毛巾模板开始的,所以这些第三方模块没有注册。我当时在同一个地点,我正在跟踪PluralSight视频。我的app.js中缺少
breezeangular
和breeze.directives
。谢谢
var app = angular.module('app', [
// Angular modules
'ngAnimate', // animations
'ngRoute', // routing
'ngSanitize', // sanitizes html bindings (ex: sidebar.js)
// Custom modules
'common', // common functions, logger, spinner
'common.bootstrap', // bootstrap dialog wrapper functions
// 3rd Party Modules
'breeze.angular', // configures breeze for an angular app
'breeze.directives', // contains the breeze validation directive (zValidate)
'ui.bootstrap' // ui-bootstrap (ex: carousel, pagination, dialog)
]);