Thursday, 3 October 2013

How do I bind following object with following model?

How do I bind following object with following model?

This is my object
$scope.status = [{ "code": "CNA", "name": "Consignee Not Available" }, {
"code": "TBD", "name": "To Be Delivered" }, { "code": "CRA", "name":
"Consignee Refused To Accept" }, { "code": "D", "name": "Delivered" } ]
my HTML is as follows
<select ng-options="status.name for status in status"
ng-model="awb.delivery_fail_reason"> <option value="">Please Select
Status</option> </select>
so what I want is
when user selects the status To be Delivered my model variable
awb.delivery_fail_reason should be set to TBD
when model awb.delivery_fail_reason is TBD it should automatically set
select to To Be Delivered Is this possible ?