我正在开发一个使用基于AngularJS的Ionic Framework的移动应用程序。从指令外的指令中获取ng-repeat中的数据
在一个指令我遍历一个JSON阵列与ng-repeat
应用条件与ng-if
,见下图:
<ion-content class="has-header has-subheader" >
<ion-slide-box">
<ion-slide
ng-if="invocation.title_id == titleid"
ng-repeat="invocation in invocations" >
<h3>{{invocation.id}}</h3>
<div ><h1>{{invocation.invocation_frensh }}</h1></div>
<div ><h1>{{invocation.invocation_ar}}</h1></div>
<div ><h1>{{invocation.invocation_franko}}</h1></div>
<div ><h1>{{invocation.comments_fr}}</h1></div>
<div ><h1>{{invocation.comments_ar}}</h1></div>
</content>
</ion-slide>
</ion-slide-box>
<p>{{invocation.id}}</p>
</ion-content>
的一点是,在最后p
什么也看不见了。
据我所知,$范围是不一样的,但最后"p"
或ng-repeat
以外的任何其他组件,我需要有相同的数据才能与它交互。
例如,我想在获取"{{invocation.id}}"
的页脚上添加一个按钮。如果invocation.id等于3在ng-repeat "h3"
内我想要它等于3在"p"
我该怎么做?
感谢您帮助
编辑:其实我是想调用[指数] .ID在循环,其中指数等于显示的幻灯片外的“P”。
调用在循环之外没有意义。你想在p标签中引用哪个调用对象? – TGH
如果重复多次 - 你想在页脚中显示哪个invocation.id会怎么样?最后一个? – pixelbits
感谢您的意见。我希望看到与循环中显示的相同的invocation.id。我应该说离子载玻片更具体。 – Fahd