Skip to content

Default picker choice? #42

Description

@maeishoj

Hi there.

I am using this and I am very happy with it.

However I am not sure how to go about selecting the default choice for the picker...

Currently i do this:

<select class="m-l-20 pull-right selectpicker" selectpicker ng-model="currentLanguage">
    <option ng-repeat="language in defaultLanguage" data-content="<span class=''><img src='/assets/img/flags/{{language.Value}}.png'/> {{language.Name}}</span>" value="{{language}}"> </option>

    <option ng-repeat="language in campaign.Languages" data-content="<span class=''><img src='/assets/img/flags/{{language.Value}}.png'/> {{language.Name}}</span>" value="{{language}}"> </option>
</select>

But it seems a very nasty way of doing it.. Basically I have my Languages as objects in an array (campaign.Languages) but in order to have the first language selected by default I have to add the first and do ng-repeat on an array with 1 single item which i initialize it to be the first language of the main language array.

There must be a better way of doing this..

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions