0

suppose there are so many fields in js object and i want to load only few not all. i was searching on this for getting answer. i got one but i am not sure this is right one.

see the fiddle http://jsfiddle.net/vojtajina/js64b/14/

see this code ng:repeat="(i,th) in head" this is the way where we need to specify something in bracket. i have confusion here. so anyone can help me to understand how to load few selected data with ng-repeat. thanks

Monojit Sarkar
  • 2,353
  • 8
  • 43
  • 94
  • What do you mean by not them all ? If your client side you have either already your whole objects or you have filtered bojects from server. Otherwise check the answer there http://stackoverflow.com/questions/19349881/at-underscore-js-can-i-get-multiple-columns-with-pluck-method-after-input-where. You could filtered all required fields in your controller into another list which you can bind to the scope so it won't be too heavy. – Walfrat Apr 18 '16 at 15:15
  • just tell me what kind of code it is `ng:repeat="(i,th) in head"` what the code is doing? what will be store in i & th ? – Monojit Sarkar Apr 18 '16 at 15:25
  • it seems that you luck basic knowledge of how ng-repeat works please have a look on the documentation and read on my answer, if further explanation is needed i would be happy to update the answer – Sarantis Tofas Apr 18 '16 at 16:18

1 Answers1

1

If i understand correct you want to know what the (i,th) values print:

First i suggest that you read on the ng-repeat documentation

i is the key of your object and th is the value:

scope.head = {
    a: "Name",
    b: "Surname",
    c: "City"
};

So for this object example that your provided i equals to a,b,c and th equals to "Name", "Surname","City"

Sarantis Tofas
  • 5,097
  • 1
  • 23
  • 36