无法在环回中仅对一个 url 执行'XMLHttpRequest' 'send'



strongloop/loopback node.js服务器与'ng-admin'编辑器和sqlite db一起使用。我需要获得实体的数量:

  var Httpreq = new XMLHttpRequest();
  Httpreq.open('GET', yourUrl, false);
  Httpreq.send(null);
  return Httpreq.responseText;

其中 yourUrl就像 http://localhost:3000/api/v1/entity/count

所有URL都起作用,除了一个名为"广告"的实体之一,我有angular.js:12783 Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load http://localhost:3000/api/v1/advertisement/count。此URL在API Explorer中起作用。

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": {}
  }
}

重命名为商业的实体来解决此问题。

最新更新