Giter VIP home page Giter VIP logo

Comments (2)

machineboy2045 avatar machineboy2045 commented on July 22, 2024

Thanks!

The directive doesn't work with ng-options. I tried, but it always had some
glitches. You need to use the Selectize config hash to define your value
and label keys. Your options can be a hash, that's fine. Selectize offers
grouping options but I've never tried them. Let me know if you can get them
to work.

On Sat, May 31, 2014 at 2:25 PM, Michael [email protected] wrote:

Hey there,
great work! took me a while to find your directive when searching for
angular selectize as other more incomplete directives came first in google.

Anyhow, on to the problem. I am currently using chosen as a select
replacement, but want to move to selectize for various reasons. Most of my
option data sources are hashsets rather than arrays of objects so I am
using the following notation:

ng-options="country.iso as country.name group by country.continent for
(key, country) in vm.lookups.countries"

countries lookups looks like:
{
GB: {iso:'GB', name: 'United Kingdom', continent: 'Europe'},
IT: {iso:'IT', name: 'Italy', continent: 'Europe'}
}

I tried playing around with the plnkr you have posted but could not get
selectize to work with ng-options. Any idea why the above is not working
and what should be done to support it?


Reply to this email directly or view it on GitHub
#3.

from angular-selectize.

masimplo avatar masimplo commented on July 22, 2024

I see, it took me a while to get my head around how selectize is configured as it is totally different than other select controls, but I think I finally got it. There is a "hidden" property in the configuration object (at least I did not find in the docs) called optgroups which you can populate by calling addOptgroup and then refreshing the control or even better set it in the config object.

here is a fiddle with my solution, http://plnkr.co/edit/09qE7H07dRAJRg3kECko?p=preview

from angular-selectize.

Related Issues (20)

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.