Saturday, 15 September 2012

Get the object length in angularjs is undefined -


How do I get an object's length?

My object in the console looks like this:

  object {2: true, 3: true, 4: true}  

.length me undefined . I just want to get the result = 3 for this case.

  var key = object Key (obeys instance); Var len = keys.length;  

Where is your "length" from.

There may be situations which I did not think about why this does not work, but you should do it, give your example.


No comments:

Post a Comment