I have this code in my controller that retrieves a list of offers from a service:
mosServiceFactory.allOffers().then(function (response) {
$scope.Offers = response.data.offers;
console.log(JSON.stringify($scope.Offers));
});
In my HTML, I use the following code to display the list of options in a select tag:
<select ng-model="offerList" ng-option="offer.campaignName for offer in Offers"></select>
The JSON response I receive in the service ($scope.Offers) looks like this:
[{
"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 from 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
}]
This scenario is similar to the one shown in this plunker http://plnkr.co/edit/fMAGnonoM9JvuIKvnOYU?p=preview, the only difference being that I am receiving a list in the response.
Despite everything seeming correct, I'm unable to see the options in my HTML file!