Javascript 如何使用AngularJS根据液滴列表中的选定值显示元素
这是我的html:Javascript 如何使用AngularJS根据液滴列表中的选定值显示元素,javascript,angularjs,Javascript,Angularjs,这是我的html: <select ng-model='selectedtype' ng-options='item.tagname for item in types.name'> <option value="">select type</option> </select> <p ng-show = 'selectedtype.tagname in {{primitives}}'> <br>value
<select ng-model='selectedtype' ng-options='item.tagname for item in types.name'>
<option value="">select type</option>
</select>
<p ng-show = 'selectedtype.tagname in {{primitives}}'>
<br>value of the field : <input ng-model='blockvalue' type='text' name='blockvalue'> <br>
</p>
这是一个可以选择的示例:
{
"tagname": "gmd:abstract",
"#text": "Abstract"
},
{
"tagname": "gco:CharacterString",
"#text": "Primitive type"
}
我知道这个表达式不能工作,但我无法找到使它工作的方法。由于原语是一个数组,您可以这样做:
<p ng-show = 'primitives.indexOf(selectedtype.tagname) != -1'>
<br>value of the field : <input ng-model='blockvalue' type='text' name='blockvalue'> <br>
</p>
字段的值:
使用原语.indexOf(selectedtype.tagname)!=-1 in ng秀
<p ng-show = 'primitives.indexOf(selectedtype.tagname) != -1'>
如果完美的话!谢谢你,我会尽快回答我的问题
<p ng-show = 'primitives.indexOf(selectedtype.tagname) != -1'>