i have following code returns me list of offers service in controller
mosservicefactory.alloffers().then(function (response) { $scope.offers = response.data.offers; console.log(json.stringify($scope.offers)); }); i using following code in html display list of options in select tag
<select ng-model="offerlist" ng-option="offer.campaignname offer in offers"></select> the json response in service (which stored in $scope.offers):
[{ "offerid": "8a1b0cb44e76781e014e767e7b120001", "campaignname": "instant july offer", "campaigndescription": "30% discount on apple", "campaignstartdate": "2015-07-12", "campaignenddate": "2015-07-22", "status": "active", "enrollmentid": "8a1b0cb44e66dba9014e670a0f8c0001", "discount": "30", "discountunit": "discount %", "datecreated": "2015-07-10", "datemodified": null, "instantoffid": 1, "basketofferitemid": null, "basketofferquantity": 0, "basketquantity": 0 }, { "offerid": "8a6804c24e53e4ab014e53fe72770000", "campaignname": "july2", "campaigndescription": "weekend offer first 100 customers.", "campaignstartdate": "2015-07-08", "campaignenddate": "2015-07-11", "status": "expired", "enrollmentid": "8a1b0cb44e4e8e2b014e53333d5d0001", "discount": "20", "discountunit": "discount $", "datecreated": "2015-07-03", "datemodified": null, "instantoffid": 0, "basketofferitemid": null, "basketofferquantity": 0, "basketquantity": 0 }, { "offerid": "8a1b0cb44e61e491014e622088460003", "campaignname": "weekend discount", "campaigndescription": "50% discount", "campaignstartdate": "2015-07-06", "campaignenddate": "2015-07-07", "status": "inactive", "enrollmentid": "8a1b0cb44e61e491014e6207fbaa0001", "discount": "50", "discountunit": "discount %", "datecreated": "2015-07-06", "datemodified": "2015-07-06", "instantoffid": 0, "basketofferitemid": null, "basketofferquantity": 0, "basketquantity": 0 }, { "offerid": "8a1b0cb44e766cd5014e766ed37b0000", "campaignname": "abc offer", "campaigndescription": "50% discount on apple", "campaignstartdate": "2015-07-12", "campaignenddate": "2015-07-17", "status": "active", "enrollmentid": "8a1b0cb44e61e491014e6207fbaa0001", "discount": "50", "discountunit": "discount %", "datecreated": "2015-07-10", "datemodified": null, "instantoffid": 1, "basketofferitemid": null, "basketofferquantity": 0, "basketquantity": 0 }] its similar plunker http://plnkr.co/edit/fmagnonom9jvuikvnoyu?p=preview
only difference getting list in response.
but somehow, cant see options in html file !
it should ng-options instead of ng-option
Comments
Post a Comment