Skip to content

onChange blocked #46

Closed
Closed
@PaddyMann

Description

@PaddyMann

Setting an onChange config option has no effect.

Could be fixed by adding a line to selectize.js config.onChange:

      config.onChange = function(value){
        if( !angular.equals(selectize.items, scope.ngModel) )
          scope.$evalAsync(function(){
            var value = angular.copy(selectize.items);
            if (config.maxItems == 1) {
              value = value[0]
            }
            modelCtrl.$setViewValue( value );
          });
        scope.config.onChange(value);
      }

For some reason my onChange function now gets called twice. Better than not at all though....

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