Angularjs 使用breeze-The';结构类型名称';参数必须是';字符串';
我正在学习John Papa关于pluralsight的SPA课程,我遇到了一个错误,即在使用breeze时,“structuralTypeName”参数必须是“string”。下面是抛出的实际错误 生成此错误的代码是metadataStore.getEntityType:Angularjs 使用breeze-The';结构类型名称';参数必须是';字符串';,angularjs,breeze,Angularjs,Breeze,我正在学习John Papa关于pluralsight的SPA课程,我遇到了一个错误,即在使用breeze时,“structuralTypeName”参数必须是“string”。下面是抛出的实际错误 生成此错误的代码是metadataStore.getEntityType: function extendMetadata() { names var metadataStore = manager.metadataStore; var types = me
function extendMetadata() { names
var metadataStore = manager.metadataStore;
var types = metadataStore.getEntityType();
types.forEach(function(type) {
if (type instanceof breeze.EntityType) {
Set(type.shortName, type)
}
});
function set(resourceName, entityName) {
metadataStore.setEntityTypeForResourceName(resourceName, entityNames);
}
它由我的素数函数调用
function prime() {
if (primePromise) return primePromise //if primePromise was loaded before, just return it
primePromise = $q.all([getLookups()])
.then(extendMetadata)
.then(success);
return primePromise;
function success() {
setLookups();
log('Primed the data');
}
我不确定breeze电话有什么问题。对如何解决这个问题有什么见解吗?谢谢你对社区的帮助
尼克
以下是查找查询信息:
function setLookups() {
var entityNames = {
personnel: 'Personnel',
cto: 'Cto',
kkeys: 'Kkey',
promotion: 'Promotion',
loa: 'Loa'
};
service.lookupCachedData = {
ctos: _getAllLocal(entityNames.cto, 'ctodate' )
kkeys: _getAllLocal(entityNames.kkeys, 'keystamp'),
promotions: _getAllLocal(entityNames.promotion, 'pdate'),
loas: _getAllLocal(entityNames.loa, 'lstrdte')
}
}
function _getAllLocal(resource, ordering) {
return EntityQuery.from(resource)
.orderBy(ordering)
.using(manager)
.executeLocally();
}
function getLookups() {
return EntityQuery.from('Lookups')
using(manager).execute()
.then(querySucceeded, _queryFailed)
function querySucceeded(data) {
log('Retrieved [Lookups] from remote data source', data, true);
return true;
}
}
function _queryFailed(error) {
var msg = config.appErrorPrefix + 'Error retrieving data from entityquery' + error.message;
logError(msg, error);
throw error;
}
必须将字符串传递给getEntityType。对不起,我第一次错过了
metadataStore.getEntityType('cto');
此外,当您试图调用
Set()
函数时,也会发生爆炸,但函数名是Set()
,而且Set可能是您不想覆盖的关键字。您必须将字符串传递给getEntityType。对不起,我第一次错过了
metadataStore.getEntityType('cto');
此外,当您试图调用
Set()
函数时,也会发生爆炸,但函数名是Set()
,而且Set可能是您不想覆盖的关键字。您必须将字符串传递给getEntityType。对不起,我第一次错过了
metadataStore.getEntityType('cto');
此外,当您试图调用
Set()
函数时,也会发生爆炸,但函数名是Set()
,而且Set可能是您不想覆盖的关键字。您必须将字符串传递给getEntityType。对不起,我第一次错过了
metadataStore.getEntityType('cto');
另外,当您试图调用
Set()
函数时,您也会崩溃,但是函数名是Set()
,而且Set可能是您不想覆盖的关键字。您能显示您的查询吗?嗨,谢谢您的回复。我在上面添加了更多信息。我想你是在问关于设置查找和getLookups的问题?你能展示一下你的查询吗?嗨,谢谢你的回复。我在上面添加了更多信息。我想你是在问关于设置查找和getLookups的问题?你能展示一下你的查询吗?嗨,谢谢你的回复。我在上面添加了更多信息。我想你是在问关于设置查找和getLookups的问题?你能展示一下你的查询吗?嗨,谢谢你的回复。我在上面添加了更多信息。我猜你问的是设置查找和获取查找?doh!!!。很高兴你看到了那套。所以我想我必须遍历我所有的实体。示例johnpapa具有proto.getEntityTypes=function(){return getTypesFromMap(this.\u structuralTypeMap);};正如您所指出的,我的breeze有proto.getEntityType=函数(structuralTypeName,okIfNotFound){assertParam(structuralTypeName,“structuralTypeName”).isString().check();assertParam(okIfNotFound,“okIfNotFound”).isBoolean().isOptional().check(false);返回这个; }; 谢谢!!!。很高兴你看到了那套。所以我想我必须遍历我所有的实体。示例johnpapa具有proto.getEntityTypes=function(){return getTypesFromMap(this.\u structuralTypeMap);};正如您所指出的,我的breeze有proto.getEntityType=函数(structuralTypeName,okIfNotFound){assertParam(structuralTypeName,“structuralTypeName”).isString().check();assertParam(okIfNotFound,“okIfNotFound”).isBoolean().isOptional().check(false);返回这个; }; 谢谢!!!。很高兴你看到了那套。所以我想我必须遍历我所有的实体。示例johnpapa具有proto.getEntityTypes=function(){return getTypesFromMap(this.\u structuralTypeMap);};正如您所指出的,我的breeze有proto.getEntityType=函数(structuralTypeName,okIfNotFound){assertParam(structuralTypeName,“structuralTypeName”).isString().check();assertParam(okIfNotFound,“okIfNotFound”).isBoolean().isOptional().check(false);返回这个; }; 谢谢!!!。很高兴你看到了那套。所以我想我必须遍历我所有的实体。示例johnpapa具有proto.getEntityTypes=function(){return getTypesFromMap(this.\u structuralTypeMap);};正如您所指出的,我的breeze有proto.getEntityType=函数(structuralTypeName,okIfNotFound){assertParam(structuralTypeName,“structuralTypeName”).isString().check();assertParam(okIfNotFound,“okIfNotFound”).isBoolean().isOptional().check(false);返回这个; }; 谢谢