AngularJS - ng-repeat to assign/generate a new unique ID -
I'm using a simple The problem I am facing is that before I present Kangaroo in my application, I manually codify the element's ID manually Example: < Pre> Countries in countries "data-show =" ???? "{{country.name}} has a population of {{country.population}}. You can ng-repeat to create a list of countries. Each list has a hidden row / div that can be expanded and collapsed.
& lt; Li data-show = "# country 1" & gt; {{Country.name}} has a population of {{country.population}} & lt; Div id = "country1" & gt; & Lt; P & gt; Expand / collapse content & lt; / Div & gt; & Lt; / li & gt; & Lt; Li data-show = "# country2" & gt; {{Country.name}} has a population of {{country.population}} & lt; Div id = "country2" & gt; & Lt; P & gt; Expand / collapse content & lt; / Div & gt; & Lt; / li & gt; & Lt; Li data-show = "# country3" & gt; {{Country.name}} has a population of {{country.population}} & lt; Div id = "country3" & gt; & Lt; P & gt; Expand / collapse content & lt; / Div & gt; & Lt; / li & gt; & Lt; Li data-show = "# country 4" & gt; {{Country.name}} has a population of {{country.population}} & lt; Div id = "country4" & gt; & Lt; P & gt; Expand / collapse content & lt; / Div & gt; & Lt; / li & gt;
ng-repeat :
& lt; li ng-repeat = "New code by using"
ng-repeat
$ index
& lt; li {{country.name}} has a population of {{country.population}} & lt; div id = "country - li ng-repeat =" country in country "data-show =" ???? "& gt; {{$ Index}} "& gt; & lt; p & gt; Expand / collapse content & lt; / div & gt; & lt; / li & gt;
Comments
Post a Comment