Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

"Private" property access no longer allowed:

https://groups.google.com/forum/#!msg/angular/7l4j70wlPwI/dgt4chDVseAJ

My $scope returns an array. An object within this array that looks like this:

0: Object
$$hashKey: "004"
FIRST_NAME: "DAVID"
LAST_NAME: "SHORT"
_id: Object
$oid: "5286f54e5b5f47d3bd3145bd"

I would like to have access to both FIRST_NAME and $oid. I can get first name like this:

  <li ng-repeat="result in apiResult">
    <form ng-submit="findone()">
      <span type="text" ng-model="searchTerm"  class="">{{result._id}}</span>
      <span class="">{{result.FIRST_NAME}}</span>
      <input class="btn-primary" type="submit" value="go">
    </form>
  </li>

I can not access _id. How can I return the id in this example?

share|improve this question
 
result._id ??? –  tymeJV Nov 20 '13 at 2:46
 
nope. this does not work –  JZ. Nov 20 '13 at 2:49
 
Damn NoSQL...my _id typically comes back in just a key/val pair, this seems to have kept the embedded object.. –  tymeJV Nov 20 '13 at 2:54
 
In your example it looks like you are just trying to display result._id, but it is an Object type. Is there a primitive field within the object you would like to display? –  jelinson Nov 20 '13 at 5:49
 
Also, why are you adding empty class attributes? –  jelinson Nov 20 '13 at 5:49
add comment

1 Answer

This is related to the introduction of private properties in Angular version 1.2.

Underscore-prefixed/suffixed properties are non-bindable

This change introduces the notion of "private" properties (properties whose names begin and/or end with an underscore) on the scope chain. These properties will not be available to Angular expressions (i.e. interpolation in templates and strings passed to $parse)

Read more..

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.