在firebase实例中创建多个表

时间:2015-12-18 04:49:45

标签: angularjs firebase

我有一个带有产品表的firebase实例。添加新产品时,我有一个下拉输入,我想从中提取用户列表,以选择输入新产品的用户。我目前正在运行此操作以获取用户列表:

<select ng-model="user">
    <option value="{{product.user}}" ng-repeat="product in products">{{product.user}}</option>
</select>

从这个JSON结构:

    {
    "products" : {
    "-K4xfUMY53523LSYZ0bhS" : {
      "category" : "Marketing",
      "comment" : "this is a comment",
      "notes" : "Note on the task",
      "due" : "Fri Dec 2 2015 00:00:00 GMT-0500 (EST)",
      "profile_pic" : "url-to-picture",
      "read" : true,
      "task" : "example task to be completed",
      "user" : "Elon"
    },
    "-K5cBQWgDVP_5uWUW-g6" : {
      "category" : "Sales",
      "comment" : "this is a comment",
      "notes" : "Note on the task",
      "due" : "Fri Dec 2 2015 00:00:00 GMT-0500 (EST)",
      "profile_pic" : "url-to-picture",
      "read" : true,
      "task" : "Fix this title",
      "user" : "Mike"
    },
    "-K5cdlpzdF5mBtPJQ5z6" : {
      "category" : "Planning",
      "comment" : "this is a comment",
      "due" : "Fri Dec 25 2015 00:00:00 GMT-0500 (EST)",
      "notes" : "Note on the task",
      "profile_pic" : "url-to-picture",
      "read" : false,
      "task" : "This is a task",
      "user" : "Mike"
    },
    "-K5lmtlJqtYfWlhdyGm6" : {
      "category" : "Sales",
      "comment" : "This is a comment on the task",
      "due" : "Fri Dec 15 2015 00:00:00 GMT-0500 (EST)",
      "notes" : "Note on the task",
      "profile_pic" : "url-to-picture",
      "read" : false,
      "task" : "Sales goals",
      "user" : "Jim"
    },
    "-K5mHm3a6DPYqjGx_eaN" : {
      "category" : "Sales",
      "comment" : "This is a comment",
      "due" : "Fri Dec 5 2015 00:00:00 GMT-0500 (EST)",
      "notes" : "Note on the task",
      "profile_pic" : "url-to-picture",
      "read" : true,
      "task" : "Title of task",
      "user" : "John"
    }
  }
}

问题在于,我为每个条目都获得了用户。因此,名称将不止一次显示,而不是显示每个唯一名称。有没有办法在Firebase中为用户创建另一个表?

0 个答案:

没有答案
相关问题