Hi Peter, ng-repeat will parse the ng-repeat value with regex and $parse extracted model name to get the value. If you already know the string passed to ng-repeat, you just have to retrieve the given model value.
Example for ng-repeat="car in cars" You just have to retrieve "cars" model value. To retrieve the model value, you have 2 options : - use by.model <https://github.com/angular/protractor/blob/master/docs/api.md#protractorbyprototypemodel>() (if your model is attached to a node) - user evaluate() <https://github.com/angular/protractor/blob/master/docs/api.md#api-elementfinder-prototype-evaluate> (to call on the node where the model scope is attached on) I hope it will help you. Regards, Charly. Le jeudi 17 juillet 2014 22:29:23 UTC+2, Peter Jin a écrit : > > I am currently using Protractor to do end-to-end testing on my > application. I've been trying to get the original array that was used to > construct a set of *ng-repeat* elements. > > I tried using the following: > > *var object = element.all(by.repeater("car in cars"));* > *console.log(object);* > > The above returns a small object with only a few properties and methods. > > I also tried resolving the above with a $promise: > > *element.all(by.repeater("car in cars")).then(function(data){* > * console.log(data);* > *});* > > This logs an object with a long list of properties and methods, but I > still do not see anything that would give me the original array used to to > create the *ng-repeat* elements. > > How can I access the original array used? > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
