javascript - Assigning numbers to ng-repeat directive's item name -


I have a recursive analogy instruction, which is nested in itself for a long time. The problem is that it is not working properly because the names of objects in ng-repeater are exactly the same as the external element. Understanding this is a bit difficult, so I will provide some simple code to display this problem:

  & lt; div ng-repeat = "item in item" & gt; & Lt; Div ng-repeat = "item in item" & gt; {{Item.value}} & lt; / Div & gt; & Lt; / Div & gt;   

The value of the item is external & lt; Div & gt; instead of an internal one.

What numbers do I want, based on the nesting of a nest, (i.e. 0 - root ng-repeat, 0-1 - second child of root dior, 1-0, first child of second dier and this Like) when the instructions were displayed on a template named after each item:

  & lt; div ng-repeat = "item-1 item" & gt; & Lt; Div ng-repeat = "items -0-0 in items" & gt; {{Item.value}} & lt; / Div & gt; & Lt; / Div & gt;   

This is my directive:

  app.directive ('recursivefields', function ($ compilation, $ http) {return {scope: {field: Restrict: 'E', Replace: Correct, Controller: "httpPostController", Template: '& lt; div ng-repeat =' Field.nestedFields in Nested Field '' = 'field', model: '= model'}, gt; & lt; div ng-show = "{{Nestedfeld.ISTTA & amp ;! Nestedfield.ISENU}}" & gt; '+' & lt; p ng-show = {{nested field.ISRAAFair}} & gt; {{Nestedfeld .name}} *: & lt; / p & gt; '+' & lt; p ng- show = {{nested field.usu Raiyarad}}> {{Nestedfeld .name}}:  '+'  + '& Lt; / Div> + '& Lt; / Div & gt; ', link: function (area, element, attrs, controller) {if (scope.field & scope.field.restResourceName! = Null) {$ http.get (CONSTANTS.EXPLAIN_URL + " / "+ Scope.field.restResourceName) .vivet (function (data, position) {scope.field.nestedFields = []; Data Content.resource.fields.forEach (work (field) {if (field.isEnum) {$ Http.get (CONSTANTS.ENUMS_URL + scope. $ Root.parseClassName (field.type). Success (work (data, status) {for field.enumValues ​​= []; (varici index.content.values ) {Field.enumValues.push (data.content.values ​​[index])}}})} scope.field.nestedFields.push (field);})})} scope.edendirect = function ($ event , Ma Le field) {// var Rikarsivfild = $ ( '& lt; recursive field model = "model" field = "field" & gt; & lt; / recursive- farms & gt;'); Var recursivefield = $ ('& lt; p & gt; new text & lt; / p & gt;'); recursiveFields.insertAfter ($ event.target); $ RecursiveFields (scope); } Scope.getRandomSpan = function () {return Math.floor ((Math.random () * 6) + 1); }}}})   

How can any ideas be obtained? Every useful answer is highly appreciated and evaluated.

Thank you.

Why do not you use any other name?

  & lt; Div ng-repeat = "item in item" & gt; & Lt; div ng-repeat = "internal ITM in item" & gt; {{Item.value}} {{innerItem.Value}} & lt; / Div & gt; & Lt; / Div & gt;   

Or your suggestion might be this template:

  Template: '& lt; Div ng-repeat = 'nested field [$ id] in field.nestedFields ..... "& gt;   

Where $ id is the new scope identifier created by your instruction. / P>

Of course, in this case you should specify $ id when accessing ScopeWars:

  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -