'Join' two models in angularjs -
i have form display editable values. 1 of values id of user. don't want display id of user want display users name.
i , works great:
<div class="control-group"> <label class="control-label" for="type">point of contact</label> <div class="controls"> <select ng-model="device.poc" ng-options="user._id user.username user in users"> </select> </div>
now trying display list of devices in non-editable form loop devices ng-repeat.
<div ng-repeat="device in devices | filter:{registered: true}" class="top-gap"> <div class="row"> <div class="span2"> {{device.name}} </div> <div class="span2"> {{device.poc}} </div> </div>
but device.poc not want display, want display users name attached device. in mustaches '{{}}' can 'join' users model did in select can display users name?
if want device.poc property hold user object, change ng-options to:
user.username user in users
then should able do
{{device.poc.username}}
and need id, device.poc._id
Comments
Post a Comment