angularjs – BreezeJS entityManagerFactory未知提供者ASP.NET
发布时间:2020-12-17 06:52:53 所属栏目:安全 来源:网络整理
导读:我正在将entityManagerFactory注入Angular,但是我收到了一个错误.正如John Papa的例子一样,这在datacontext模块中完成.错误是未知的提供者.我在index.html文件中包含了entityManagerFactory.js文件但没有成功.有任何想法吗? function () { 'use strict'; va
我正在将entityManagerFactory注入Angular,但是我收到了一个错误.正如John Papa的例子一样,这在datacontext模块中完成.错误是未知的提供者.我在index.html文件中包含了entityManagerFactory.js文件但没有成功.有任何想法吗?
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 }; } } 解决方法
我有同样的错误,解决方案很简单,并在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> 确保在entityManagerFactory.js之前加载了app.js. 不要忘记在app.js中包含对breeze模块的引用. 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) ]); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |