Search code examples
angularjsmixitup

Is it possible to add a string before the value in ng-select?


I'm trying to add a string before the value in ng-select?

I'm using mixItup plugin and would like to have filer values in a drop down, but mixitup required "." in the option value.

This is what I'm getting now:

<select class="form-control" ng-model="category" ng-options="cat.id as cat.name for cat in categories">
     <option label="Public" value="number:1">Public</option>
     <option label="Personal" value="number:2">Personal</option>
</select>

That is what I required:

<select class="form-control" ng-model="category" ng-options="cat.id as cat.name for cat in categories">
     <option label="Public" value=".cat-1">Public</option>
     <option label="Personal" value=".cat-2">Personal</option>
</select>

my code:

<select class="form-control" ng-model="category"
                    ng-options="cat.id as cat.name for cat in categories">
</select>

Is this even possible?


Solution

  • Yes. You can use ng-options="'.' + cat.id as cat.name for cat in categories" http://jsfiddle.net/dp31o591/