AngularJS – 三个相关的select – 只有前两个填充

我正在使用Express,Angular和Jade。 应用程序的相关部分允许用户从其Trello帐户中select组织,董事会和列表。 三个项目形成一个层次结构:组织包含板,板包含列表。

所以在我的玉石部分,我有以下几点:

select(ng-model='userData.apps.trello.organization', ng-options='orgId as orgDetails.name for (orgId, orgDetails) in orgsandboards') select(ng-model='userData.apps.trello.board', ng-options='boardId as boardDetails.name for (boardId, boardDetails) in orgsandboards[userData.apps.trello.organization]["boards"]') select(ng-model='userData.apps.trello.list', ng-options='listId as listDetails.name for (listId, listDetails) in orgsandboards[userData.apps.trello.organization][userData.apps.trello.board]["lists"]') 

上面的语法,来自这个有用的答案 。

无论如何,数据结构 – 以上面的答案为蓝本 – 如下所示:

 orgsandboards: { orgid1: { name: "organization 1", boards: { boardid1: { name: "name of the first board", lists: { listid1: { name: "name of list 1" }, listid2: { name: "name of list 2" } } }, boardid2: { name: "name of the second board", lists: { listid3: { name: "name of list 3" }, listid4: { name: "name of list 4" } } } } }, orgid2: {.. and so on ..} } 

前两个select很好。 如果我改变组织,潜在董事会的名单也会改变。 但是,第三个select列表从不更新。 我已经validation数据是存在和可用的。

我已经通过其他问题和答案,包括这个和这个 。 在这里经常发生,似乎没有提供我寻求的答案。

谢谢。

看起来像是Angular的原谅自然屏蔽了一个错误的情况。 第三个列表的ng-options需要结束于:

 in orgsandboards[userData.apps.trello.organization]["boards"][userData.apps.trello.board]["lists"] 

注意["boards"]部分。

你现在拥有它的方式,你在orgsandboards[userData.apps.trello.organization]中引用了一个不存在的键,但是Angular通常不会在这些情况下抛出错误 – 它只是在默默地失败。