2

I’d like to include a partial template inside my main template, but having a specific scope when I call the partial template.

For example, this is my main template (very simplified, actual template is more complicated, so ng-iterate can’t be used here) :

<h1>title, my item1 name is {{item1.name}}</h1>
....
<div ng-view="myPartial.html" scope="item1"></div>
....
<div ng-view="myPartial.html" scope="item2"></div>
...

And myPartial.html is something like

<input ng-model="name" />...

data :

{item1: {name:"test1"}, item2: {name: "test2"}}

expected result :

<1>title, my item1 name is test1</h1>
....
<div><input value="test1" /></div>
....
<div><input value="test2"></div>
...

How would you do this kind of thing using angularjs ?

Should I create a specific directive with myPartial.html as template ?
Thanks