P
P
pofigizm2014-06-02 18:08:19
JavaScript
pofigizm, 2014-06-02 18:08:19

How to pass data to ng-include?

I don't know how to put it right.
I have a recursive ng-include call in a part.html file

<span> Part: </span>
<span> {{part.name}}</span>
<div class='node' ng-repeat='part in part.parts' ng-include="'parts.html'"></div>

But when I include it in index.html,
<div ng-include="'parts.html'"></div>
how do I specify its scope?
I can only achieve the desired behavior by adding an extra ng-repeat and filter
plnkr.co/edit/6C1b1QXzcPDxvUWdn3L0
$scope.current is the object that I want to pass to ng-include, previously calling it parts

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2015-01-08
Kozulya @5angel

ng-include has an onload parameter that can execute arbitrary code.
So one can write:
I think the author has already found his answer, but you never know (:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question