1

i want to create scope with dynamic name

eg.

  <div ng-repeat="id in ides">
         < .... ng-model="id.eId">
  </div>

now i wan to create and display my n (size of ides) scopes. eg like

<div>
      <span>{{scopevalue"id.eId".name}}</span>
</div>

how can this be done with angular

1
  • I don't understand what your are looking for, for example id.eId contains "No1", you want to access scopevalueNo1 variable ? Commented Aug 1, 2015 at 9:59

1 Answer 1

1

You should use bracket notation in this case. For example like this (define $scope.names = {}; in controller too):

<div ng-repeat="id in ides">
    <input type="text" ng-model="names[id.eId].name" />
</div>

and then you can do

<div>
     <span>{{names[id.eId].name}}</span>
</div>
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.