0

I have a list of countries which were loaded into
angular ui-select

Detail of code is as below

%ui-select{'ng-model' => 'item.country', 'append-to-body' => 'true', 'search-enable' => 'true', 'them' => 'bootstrap'}
                %ui-select-match{'allow-clear' => 'true', placeholder: :'select country'}{{$select.selected.name}}
                %ui-select-choices{'repeat' => "country.code as country in countries | filter:$select.search"}
                  %span {{country.name}}

Every object country have 2 properties are CODE and NAME when i selected an item the value and displayed text are always NAME

My expected is when selecting an item the value is CODE and the displayed text is NAME. %ui-select-choices element can become like this:

%option{'ng-repeat' => "country in countries", 'value' => '{{country.code}}', 'text' => '{{country.name}}'}

How can i resolve this?

huynhthinh
  • 61
  • 1
  • 1
  • 9

1 Answers1

0

Try country.code as country.name for country in countries

Scott
  • 1,690
  • 3
  • 13
  • 18
  • if we use the expression country.code as country.name for country in countries in repeat error will occur. This expression is fine for ng-option – huynhthinh May 07 '15 at 02:29