How to access nested ng-repeat elements
See original GitHub issueI am trying something like:
element.all(by.repeater('suggestion_type in searchBoxData.suggestion_types')).then(function(rows) {
for(var i=0;i<rows.length;i++){
rows[i].then(function(){
element.all(by.repeater('content in suggestion_type.contents')).then(function(rows_2) {
console.log(rows_2);
});
});
}
});
but I am getting duplicate rows…
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
json - Nested ng-repeat - Stack Overflow
Day can have any number of Jobs, Jobs can be nested and contain any number of other Jobs. Now using this code <p...
Read more >How To Use Nested ng-repeat In AngularJS - C# Corner
The ng-repeat directive instantiates a template once per item from a collection like array, list etc. In this blog, I am using nested...
Read more >Using ng-repeat in Nested Loops in AngularJS - ASPSnippets
The TBODY element of the nested HTML Table has been assigned ng-repeat directive in order to iterate through all the items of the...
Read more >ngRepeat - AngularJS: API
The ngRepeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop...
Read more >Nested objects/arrays with ng-repeat on Service Portal
It should start with just element. First ng-repeat: ng-repeat = "element in c.data.element".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the delay, missed this issue:
suppose your set up is as follows:
The reason you’re getting duplicates is because you’re iterating all of the nested elements many times (in fact you are iterating (list1.length)^2 * (list2.length) times instead of list1.length*list2.length as you intended), because in your inner loop, you’re not saying search within the outer ng-repeat, you’re searching within the entire dom.
This will fix it:
note the
rows[i].all(by.repeater...)
instead ofelement.all(by.repeater...)
in your inner loop.To make it simpler you can just do this:
Hope this answers your question
Hi All,
I am testing an example using protractor. I need to select the data which is showing in ng-repeate
getting error. Any help much appreciated. Thanks
element.all(by.repeater(‘branch in branches’)).get(1).element(by.linkText(‘branchName’)).click()