GithubHelp home page GithubHelp logo

kbanman / selectize-ng Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 7.0 24 KB

Selectize directive for AngularJS with two-way bindings for both values and options

License: MIT License

JavaScript 89.07% HTML 10.93%

selectize-ng's People

Contributors

angelix avatar kbanman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

selectize-ng's Issues

Error: data is undefined in console

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?

remove options after option list updated

Imagine following situation :

Initially you have itemList = [{id: 0, name: 'first item'}, {id: 1, name: 'second item'}];
at some moment itemList assigned to [{id: 0, name: 'first item'}, {id: 2, name: 'third item'}]

expected - selectize contain 'first item' and 'third item'
actual - selectize contain 'first item', 'second item' and 'third item'

bug?

Hello
I've been playing with selectize-ng almost whole night today and I didn't get it to work.
I am using require.js along with angular. Whatever I do I get:
(http://127.0.0.1:8000/static/selectize-ng/dist/standalone/selectize-ng.js:1179:44)
which resolves to: a.selectize() || {}), o = b.selectize(n)[0].selectize, o.on("change", function() ... Basically one of the selectizes here is missing. Line in readable form looks like:
console.log(element.selectize); //this is empty!
selectize = element.selectize(options)[0].selectize; // ~ line 20

Gist: https://gist.github.com/jacoor/8a67ef98205d1df16473

I've read people saying that there is a problem between jquery and other plugins, but I am completely confused right now. Would you be able to help?

Add an array of items programmatically while loading a view

New to AngularJs, groping around with directives...

I wonder if it's possible to add a set of default values to the selectize element, for example in the tagging mode?

It's a method of the selectize object (docs), not sure how to invoke that so as to allow items to be added in a controller.

Spurious, untraceable error in console

I have a project with selectize-ng menus. One one page, no issues. On another page, I'm getting this error (although the menu itself is working and populated):

TypeError: Cannot read property 'name' of undefined
    at a.extend.addOption (selectize-ng.min.js:2)
    at l (selectize-ng.min.js:5)
    at Object.fn (angular.min.js:120)
    at k.$digest (angular.min.js:122)
    at k.$apply (angular.min.js:125)
    at n (angular.min.js:80)
    at O (angular.min.js:84)
    at XMLHttpRequest.B.onload (angular.min.js:85)

See http://stackoverflow.com/questions/29222526/angular-js-selectize-error for full code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.