javascript - How to pass a ng-repeat variable in ng-if? -
javascript - How to pass a ng-repeat variable in ng-if? -
i have ng-repeat in first line of code , in next line need create dynamic variable based on in ng-repeat.
code this:
<div ng-repeat="head in arrayofhead"> <span ng-if="canibecreated_{{head}}">i created!!</span> </div>
where
arrayofhead = ["1","2","3"];
but produces error while can pass {{$index}} in easily.
why ditching nowadays in angularjs?
on controller
var canibecreated_1="false"; var canibecreated_2="true"; var canibecreated_3="false";
to crate , not create span.
... ng-if="somefunc(head)" ...
inside ng-repeat
block. should trick.
javascript angularjs
Comments
Post a Comment