如今有两个数组,数组test1里id的值和test2里的值是对应的,那么现在想要实现,如果test1 id值=test2.idnum里的id值的话,就把test2.idnum里的id值对应的数字输出到p标签里。请问这个要怎么做匹配并且把值写到p标签内?用filter可以做到吗?
html:
<p ng-repeat="td in test1">
<p id="{{td.id}}">
<p>该id对应的数值是:{{...}}<p>
</p>
</p>
第一个数组
$scopt.test1=[{
"id": "x01",
"imgurl": "images/banner_01.jpg",
"status": "0"
},
{
"id": "x02",
"imgurl": "images/banner_01.jpg",
"status": "0"
},
{
"id": "x03",
"imgurl": "images/banner_01.jpg",
"status": "0"
}]
第二数组
$scopt.test2=[{"dco":"xsadsq112341",
"reqs":"yes",
"idnum":{"x01":"1","x02":"3","x03":"0"}]
不知是否是要这样?
filter可以
ng-if也可以