Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

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

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

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

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

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?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

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

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

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

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

Serhii,

Thank you so much. This works like a charm.

Return to “Issues”