0

"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?

4
  • nope. this does not work Commented Nov 20, 2013 at 2:49
  • Damn NoSQL...my _id typically comes back in just a key/val pair, this seems to have kept the embedded object.. Commented Nov 20, 2013 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? Commented Nov 20, 2013 at 5:49
  • Also, why are you adding empty class attributes? Commented Nov 20, 2013 at 5:49

1 Answer 1

1

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..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.