Page 1 of 1

How can I stack Ionic select item with options from a restservice?

Posted: Thu Dec 14, 2017 4:46 pm
by Bernie

I managed to fill list item but can't fill the options of an Ionic select component.
Please, see screenshots. Any advise out there? Image Image Image


How can I stack Ionic select item with options from a restservice?

Posted: Thu Dec 14, 2017 9:58 pm
by Bernie

Ok, I figured it out partially.

ng-modal = Categories
ng-options = Categories.catname for Categories in Categories

This brings up all the values from my restservice.
But when I select one option the first time the option list goes empty.

Any ideas what am I missing?


How can I stack Ionic select item with options from a restservice?

Posted: Fri Dec 15, 2017 9:55 am
by Serhii Kulibaba

Hello Bernie,

  1. Please change the property:
    preng-modal = Categories/pre

    to:
    preng-model = selectedCategory/pre

  2. Please change the property:
    preng-options = Categories.catname for Categories in Categories /pre

    to:
    preng-options = Category.catname for Category in Categories /pre

  3. Set the default value of the select component with JS code in the services success function:
    pre$scope.selectedCategory = $scope.Categories[0].catname /pre


How can I stack Ionic select item with options from a restservice?

Posted: Fri Dec 15, 2017 4:54 pm
by Bernie

Serhii,

Thank you so much. This works like a charm.