BreezeJS的entityManagerFactory未知提供商ASP.NET提供商、entityManagerFactory、BreezeJS、ASP

2023-09-13 04:41:29 作者:你要的爱

我注射的entityManagerFactory成角,但我得到一个错误。这是在DataContext模块中正在做就像约翰爸爸的例子。该错误是未知的供应商。我包括entityManagerFactory.js index.html文件中,但没有成功文件。任何想法?

 函数(){    使用严格的;    VAR服务ID ='的DataContext';    angular.module(应用)工厂(服务ID,['普通','entityManagerFactory的','清风','记录',的datacontext]);    函数的DataContext(普通){        变量$ Q =普通$ Q。        VAR的服务= {            getPeople:getPeople,            getMessageCount:getMessageCount        };    }} 

解决方案

我有同样的错误,解决的办法很简单,并在约翰·帕帕斯博客。

记录

在您的index.html文件,请确保您有引用所需的所有的源文件,并确保他们以正确的顺序加载。

 <链接HREF =内容/ breeze.directives.css的rel =stylesheet属性/><脚本SRC =脚本/ breeze.debug.js>< / SCRIPT><脚本SRC =脚本/ breeze.angular.js>< / SCRIPT><脚本SRC =脚本/ breeze.directives.js>< / SCRIPT><脚本SRC =脚本/ breeze.saveErrorExtensions.js>< / SCRIPT><脚本SRC =脚本/ breeze.to $ q.shim.js>< / SCRIPT> <! - 只需要,如果你正在使用,以$ Q  - ><脚本SRC =应用程序/ app.js>< / SCRIPT>......<脚本SRC =应用程序/服务/ entityManagerFactory.js>< / SCRIPT> 

请确保app.js是entityManagerFactory.js之前加载

不要忘了,包括在app.js您微风模块中的引用也是如此。

  VAR应用= angular.module(应用,[    //角模块    ngAnimate',//动画    ngRoute',//路由    ngSanitize',//清理HTML绑定(例如:sidebar.js)    //自定义模块    常见的',//常用功能,记录器,微调    common.bootstrap',//引导对话框包装功能    //第三方模块    breeze.angular',//配置清风角应用    breeze.directives',//包含微风验证指令(zValidate)    ui.bootstrap'// UI的引导(例如:旋转木马,分页,对话)]); 

I am injecting the entityManagerFactory into Angular but I am getting an error. This is being done in the datacontext module just like John Papa's example. The error is unknown provider. I am including the entityManagerFactory.js file in the index.html file but no success. Any ideas?

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
        };
    }
}

解决方案

I had the same error, the solution was simple and documented in John Papas blog.

In your index.html file, make sure that you have references to all of the required source files, and that they are loaded in the correct order.

<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>

Make sure that app.js is loaded before entityManagerFactory.js

Don't forget to include references to your breeze modules in app.js as well.

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)
]);