vendredi 8 mai 2015

set dynamic options on angular chosen

I am using Angular-chosen and I am unable to set dynamic options.

my jade

label.col-sm-2.control-label Tags
                .col-sm-10(ng-init='delegate.getCategories()')
                    select.chosen-select.form-control(chosen="", multiple, ng-model="tags", ng-change='delegate.getCategories()' data-ng-options='s.categoryName for s.categoryName in tagsList')

                .clearfix

My controller class

getCategories: function(){
                constantsService.getCategories($scope.category,this.onGetCategories,this.onFailure);
                alert($scope.category);
            },
            onGetCategories:function(response){
                $scope.tagsList=response.categories;
                alert(response);
            },
            onFailure:function(response){
                alert(response);
            }

on page load the init gets the categories form the backend and and sets in tagsList variable but its not there when the html loads.

Aucun commentaire:

Enregistrer un commentaire