AngularJS, Populating dependent Combobox

前端 未结 4 1495
鱼传尺愫
鱼传尺愫 2021-01-03 07:25

What I am trying to achieve is to populate a child combobox with items which depend on a \'parent\' combobox.

To clarify the - or better my - problem, I have created

4条回答
  •  忘掉有多难
    2021-01-03 08:07

    This should be what you're after:

    http://jsfiddle.net/TsxTU/1/

    How this works is its using the select as label for item in group syntax. So for the first select box, whatever the user selects will become the object bound to currentGroup. A similar thing is done for currentItem

    We can then, optionally, use a $watch expression to be notified of that update and ensure that currentItem updates to the first item in the new group's Items array.

提交回复
热议问题