[英]Need help in AngularJS deep filtering
So, I've been trying to filter an select with another based on this informations came from a web service: 因此,我一直在尝试根据来自Web服务的以下信息来过滤选择:
{
sections: [
{
st_id: '1',
st_nm: 'name1',
blocks: [
{
bl_id: '1',
bl_nm: 'block1'
}
]
},
{
st_id: '2',
st_nm: 'name2',
blocks: [
{
bl_id: '2',
bl_nm: 'block2'
},
{
bl_id: '2-1',
bl_nm: 'block2-1'
}
// ... and so on
]
}
// ... and so on
]
}
I tried a lot of things and combinations, but I'm really new in Angular and nothing works. 我尝试了很多事情和组合,但是我真的是Angular的新手,没有任何用。 I need filter the second select, and fill with the "blocks" information, with the "st_nm" field selected in the first select element. 我需要过滤第二个选择,并在第一个选择元素中选择“ st_nm”字段,并填充“块”信息。
I'm grateful for your answers! 感谢您的回答!
I think I know what you're trying to do here and here's my suggestion: 我想我知道您要在这里做什么,这是我的建议:
<select id="st_select" ng-model="st_selected" ng-options="sect.st_nm for sect in sections">
<select id="blocks_select" ng-model="block_selected" ng-options="block.b1_nm for block in st_selected.blocks">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.