0
'ng-admin'エディタとsqlite dbで使用されるStrongloop/Loopback node.jsサーバー。私は、エンティティのカウントを取得する必要があります。ループバック内の1つのURLに対してのみ 'XMLHttpRequest'で 'send'を実行できませんでした
var Httpreq = new XMLHttpRequest();
Httpreq.open('GET', yourUrl, false);
Httpreq.send(null);
return Httpreq.responseText;
yourUrl
がhttp://localhost:3000/api/v1/entity/count
のようなものです。
すべてのURLは、「Advertisement」という名前のエンティティを除いて動作しますが、私にはangular.js:12783 Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load http://localhost:3000/api/v1/advertisement/count
があります。このURLはAPIエクスプローラで機能します。
Advertisement.json:この問題を解決するために商業にエンティティを改称
{
"name": "Advertisement",
"base": "EntityBase",
"plural": "Advertisement",
"options": {
"validateUpsert": true,
"sqlite3": {
"table": "advertisement"
}
},
"properties": {
"name": {
"type": "string",
"required": true
},
"category_id": {
"type": "number"
},
"due_date": {
"type": "string"
},
"from_date": {
"type": "string"
},
"phone": {
"type": "string"
},
"site": {
"type": "string"
}
},
"validations": [],
"relations": {
"category": {
"type": "belongsTo",
"model": "Category",
"foreignKey": "category_id"
},
"photos": {
"type": "hasMany",
"model": "Photo",
"foreignKey": "advertisement_id"
}
},
"acls": [],
"methods": {},
"mixins": {
"Timestamp": {},
"SoftDelete": {},
"GenderAge": {},
"Descripted": {}
}
}
Advertisement.jsonを表示できますか? – Overdrivr
が追加されました。同じjsonのエンティティが存在し、他の名前/テーブル/写真fkのみが存在することに注意してください。 – smg
あなたはEntityBaseを拡張し、ほぼ同じjson設定を共有する別のモデルがあることを意味しますか? – Overdrivr