javascript - How to create or return seperate scope from function in ng-repeat directive -
base code:
<tr class="" ng-repeat="row in resultoffiltering"> <td class="{{result[1]}}" ng-repeat="result in createtablebody(row)">{{ result[0] }}</td> </tr>
source of resultoffiltering changed when watch notice changes in search input or there choosen new base source, according new table body should created
createtablebody executed search after nested fields , create proper order , amount of td in tr.
issue: think know issue is, issue result keep reference last execution of createtablebody function, question how create sepereate scope each function execution ?
createtablebody function
this.createtablebody = function(obj){ var headers = $rs._headers, giveback; if(obj.headers !== headers.length) { var num = obj.headers; if(!angular.isarray(headers[num])){ giveback = obj[headers[num]]; }else{ giveback = that.givebacknestedvalues(obj, headers[num]); obj.headers += 1; return giveback; } obj.headers += 1; return [giveback, headers[num] ]; } else { return [undefined,'hidethisrow']; } };
i tried wrapp return in function(){return something}) in order create uniq scope doesn;t repair issue.
Comments
Post a Comment