gpt4 book ai didi

angularjs - Hot Towel Angular-Breeze 类(class) - 出现 BreezeProvider 错误

转载 作者:行者123 更新时间:2023-12-02 10:21:53 24 4
gpt4 key购买 nike

我正在遵循 John Papa 类(class)《使用 Angular 和 Breeze 构建应用程序 - 第 1 部分》中的每一步。当我完成题为“从第一个剪辑开始播放通过您的应用程序创建垂直切片”的模块后,我开始收到 breezeProvider 错误

下面请找到错误图像以及数据上下文。 js代码。

我们将非常感谢您的建议。

                  -------------------------------------------

在 F12 开发工具中,控制台错误是:

未捕获错误:找不到 Breeze 本地主机:1772/Scripts/breeze.angular.js:90【外壳】 Hot Towel Angular 装!空

错误:[$injector:unpr]未知提供者:breeceProvider <- Breeze <-entityManagerFactory <- datacontext

[app] [CC 错误] [$injector:unpr] 未知提供者:breezeProvider <- Breeze <-entityManagerFactory <- datacontext

Breeze error

这是我的 datacontext.js 代码:

(function () {
'use strict';

var serviceId = 'datacontext';
angular.module('app').factory(serviceId, ['common', 'entityManagerFactory', datacontext]);

function datacontext(common, emFactory) { // emFactory param refers to 'entityManagerFactory'
var EntityQuery = breeze.EntityQuery;
var getLogFn = common.logger.getLogFn;
var log = getLogFn(serviceId); // see common\logger.js
var logError = getLogFn(serviceId, 'error');
var logSuccess = getLogFn(serviceId, 'success');
var manager = emFactory.newManager(); // COMES FROM entityManagerFactory.js
var $q = common.$q;

var service = {
getPeople: getPeople,
getMessageCount: getMessageCount,
getSessionPartials: getSessionPartials
};

return service;

function getMessageCount() { return $q.when(72); }

function getPeople() {
var people = [
{ firstName: 'John', lastName: 'Papa', age: 25, location: 'Florida' },
{ firstName: 'Ward', lastName: 'Bell', age: 31, location: 'California' },
{ firstName: 'Colleen', lastName: 'Jones', age: 21, location: 'New York' },
{ firstName: 'Madelyn', lastName: 'Green', age: 18, location: 'North Dakota' },
{ firstName: 'Ella', lastName: 'Jobs', age: 18, location: 'South Dakota' },
{ firstName: 'Landon', lastName: 'Gates', age: 11, location: 'South Carolina' },
{ firstName: 'Haley', lastName: 'Guthrie', age: 35, location: 'Wyoming' }
];
return $q.when(people);
}

function getSessionPartials() {
var orderBy = 'timeSlotId, level, speaker.firstName';
var sessions;

// use Breeze to get data from back end; see datacontext() function above for init code.
return EntityQuery.from('Sessions')
.select('id, title, code, speakerId, trackId, timeSlotId, roomId, level, tags')
.orderBy(orderBy)
.toType('Session') // cast to type 'Session' (in CC.Model project)
.using(manager).execute() // communicate to back end
.then(querySucceeded, _queryFailed);
//.to$q(querySucceeded, _queryFailed); // OLD WAY: converts promise to Ang.

function querySucceeded(data) {
session = data.results;
log('Retrieved Session Partials from remote data source', sessions.length, true);
return sessions;
}
function _queryFailed(error) { // PASSED IN BY BREEZE
var msg = config.appErrorPrefix + 'Error retrieving data.' + error.message;
logError(msg, error);
throw error;
}
}
}

})();

最佳答案

真正的问题是第一个错误:找不到 Breeze 。看到 breeze.angular.js 就是那个咆哮的文件......

确保您在 index.html 中添加了 Breeze JS 文件:

<script src="scripts/breeze.debug.js"></script> // or breeze.min.js
<script src="scripts/breeze.angular.js"></script>

如果您已经添加了它,请确保它位于 breeze.angular.js 之前,如上所示。

<小时/>

这些是我的应用程序中的 breeze JS 引用:

<!-- #region Breeze -->
<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>
<!-- #endregion -->

关于angularjs - Hot Towel Angular-Breeze 类(class) - 出现 BreezeProvider 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24145230/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com