angularjs – BreezeJS entityManagerFactory未知提供者ASP.NET

前端之家收集整理的这篇文章主要介绍了angularjs – BreezeJS entityManagerFactory未知提供者ASP.NET前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在将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)
]);

猜你在找的Angularjs相关文章