Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: data is undefined in console #13

Open
tonysepia opened this issue Feb 5, 2017 · 5 comments
Open

Error: data is undefined in console #13

tonysepia opened this issue Feb 5, 2017 · 5 comments

Comments

@tonysepia
Copy link

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?

@kbanman
Copy link
Owner

kbanman commented Feb 6, 2017

Hey @tonysepia, I am not really maintaining this repository anymore, and frankly I'm surprised it still works with modern versions of angular :)

I'd be happy to transfer ownership of the repo to someone who is passionate about keeping it going.

@tonysepia
Copy link
Author

Hello Kelly,

Thank you for getting back to me. In all honesty I am a total newbie to Angular so won't be able to contribute much myself.

But using this opportunity I would like to thank you for this great angular wrapper for selectize!

Best regards,

@tonysepia
Copy link
Author

Just noticed that there is a pending Pull request that may fix this issue properly! Could you check it please?

@kbanman
Copy link
Owner

kbanman commented Feb 6, 2017

@tonysepia I have merged that PR

@kbanman
Copy link
Owner

kbanman commented Feb 6, 2017

The tests are not passing anymore, though I suspect that's mostly because of incompatibility with the latest version of angular. I will investigate further this evening, and maybe modernize the package a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants