Skip to content

Error: data is undefined in console #13

@tonysepia

Description

@tonysepia

Hi guys,

I have noticed the following error in the console:
Error: data is undefined

have traced it to the following bit of code in selectize-ng:

if (attrs.options) {
          scope.$parent.$watchCollection(attrs.options, setSelectizeOptions);
        }

I guess the expected behaviour here is that #watchCollection will only execute listener function (setSelectizeOptions) when there are new values.

However, I have added the following line into setSelectizeOptions function and confirmed that sometimes it is being called even without the newOptions argument:

function setSelectizeOptions(newOptions) {
			if(newOptions==null){
				console.log("newOptions were NULL");
			}
          var values = parseValues(ngModel.$viewValue);
          selectize.addOption(newOptions);
          selectize.refreshOptions(false);
          if (options.mode === 'multi' && newOptions) {
            restoreInvalidValues(newOptions, values);
          }
          setSelectizeValue(values);
        }

Has anyone else had similar behaviour?

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