kbanman / selectize-ng Goto Github PK
View Code? Open in Web Editor NEWSelectize directive for AngularJS with two-way bindings for both values and options
License: MIT License
Selectize directive for AngularJS with two-way bindings for both values and options
License: MIT License
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?
How about to treat ng-disabled?
Hi,
How to disable search? or not to allow empty input?
Best Regards
HJ
Hi,
Why did onChange function callback called twice?
Best Regards
H.J
If the value field is a numeric, the value returned in ngModel bound field is a string.
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'
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?
onItemAdd
is called twice when the selection in the control is changed
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.