green-arrow / ember-cli-chosen Goto Github PK
View Code? Open in Web Editor NEWUse Chosen in your ember-cli app.
License: MIT License
Use Chosen in your ember-cli app.
License: MIT License
Running: ember install ember-cli-chosen
.
Error: Install failed. Could not find addon with name: ember-cli-chosen
Now I need to re-install ember-cli because the fail borked my broccoli-static-compiler somehow?
manually removed addon, got rid of broccoli-static-compiler error.
From the Chosen docs:
By default, pressing delete/backspace on multiple selects will remove a selected choice. When false, pressing delete/backspace will highlight the last choice, and a second press deselects it.
I am attempting to use the ember-cli to create a select list that is generated dynamically based on a list of items. The list is populated (the <select><options...></select>
are correctly in place), but the actual view does not display items in the dropdown.
Here is an example of my use:
{{#ember-chosen prompt="Select Assignment"}}
{{#each assignment in model.assignments}}
<option {{bind-attr value="assignment.description"}}>{{assignment.description}}</option>
{{/each}}
{{/ember-chosen}}
From the Chosen docs:
By default, Chosen includes disabled options in search results with a special styling. Setting this option to false will hide disabled results and exclude them from searches.
Provide a way for developers to execute an action when the user attempts to add another item in a multiple select input that would cause them to exceed the maxSelectedOptions
threshold.
If you are passing a promiseArray to the #each helper to generate options, the ember-chosen component will initiate before any promises resolve and the chosen dropdown will be empty. I made a quick and dirty fix that allows passing the promiseArray into the component and waits for it to resolve before initializing. This seems like a poor solution but does work. Is this something that should be supported? Maybe any promises we need should be resolved in the route before passing it into the template. However it would be a useful feature to support. With hasMany async relationships this is a common situation.
Allow developers to specify whether you can deselect the current value on single select inputs.
From the Chosen docs:
The text to be displayed as a placeholder when no options are selected for a single select.
From the Chosen docs:
By default, searching will match on any word within an option tag. Set this option to false if you want to only match on the entire text of an option tag.
From the Chosen docs:
By default, Chosen includes selected options in search results with a special styling. Setting this option to false will hide selected results and exclude them from searches.
Note: this is for multiple selects only. In single selects, the selected result will always be displayed.
From the Chosen docs:
By default, Chosen’s search matches starting at the beginning of a word. Setting this option to true allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.
I ran the command "ember install:addon ember-cli-chosen" and it seemed to install correctly.
I added the following code to a template
{{#ember-chosen multiple=true value=model.agencyRole class='form-control' id='agency-role-field'}}
Select Agency Roles
{{#each agencyRoleList as |agencyRole|}}
<option {{bind-attr value=agencyRole.code}}>{{agencyRole.name}}
{{/each}}
{{/ember-chosen}}
When I try to go to that page, it is blank and I get the error "ember.debug.js:16591 Uncaught Error: Assertion Failed: A helper named 'ember-chosen' could not be found" in the console.
ember install:addon ember-cli-chosen
and ember install ember-cli-chosen
return the following output:Installed packages for tooling via npm.
installing ember-cli-chosen
install bower package chosen=https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip
Installing browser packages via Bower...
not-cached https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip=chosen=https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip#*
Status code of 404
Error: Status code of 404
at createError (/path/to/project/node_modules/bower/lib/util/createError.js:4:15)
at Request.<anonymous> (/path/to/project/node_modules/bower/lib/util/download.js:91:36)
at emitOne (events.js:95:20)
at Request.emit (events.js:182:7)
at Request.onRequestResponse (/path/to/project/node_modules/bower/lib/node_modules/request/request.js:951:10)
at emitOne (events.js:90:13)
at ClientRequest.emit (events.js:182:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:425:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:89:23)
at TLSSocket.socketOnData (_http_client.js:315:20)
bower: v1.7.7
node: 5.6.0
os: darwin x64
Any clues on why this happened or how to fix it? Clearing the bower cache and trying to install the specific version of chosen manually via bower does not work (the installation through bower will succeed, but the ember install:addon call will still throw the same error).
$ ember install:addon ember-cli-chosen
version: 1.13.13
This command has been deprecated. Please use `ember install <addonName>` instead.
Cannot find module 'broccoli-static-compiler'
I created a new ember cli project with ember-cli version 0.2.2.
When I run
ember install:addon ember-cli-chosen.
I get the following error:
Cannot find module 'broccoli-static-compiler'
Error: Cannot find module 'broccoli-static-compiler'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/keswanir/work/testchosen/testbrocc/node_modules/ember-cli- chosen/index.js:4:21)
If I install broccoli-static-compiler, it works fine but isn't the addon suppose to install its dependencies?
From the Chosen docs:
The text to be displayed as a placeholder when no options are selected for a multiple select.
Receiving this issue: Uncaught Error: Could not find module ember-cli-chosen/components/ember-chosen
imported from squarematics/components/ember-chosen
vendor.js:14338 DEBUG: Ember : 1.13.0-beta.1+canary.41542c6f
vendor.js:14338 DEBUG: Ember Data : 1.0.0-beta.17+canary.dcaf77bdc8
vendor.js:14338 DEBUG: jQuery : 2.1.3
vendor.js:14338 DEBUG: Ember Simple Auth : 0.8.0-beta.1
vendor.js:14338 DEBUG: Ember Simple Auth Devise : 0.8.0-beta.1
vendor.js:14338 DEBUG: Ember C3 : 0.1.2
Bower: "chosen": "https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip"
NPM: "ember-cli-chosen": "https://github.com/green-arrow/ember-cli-chosen/tarball/master"
Not sure where to begin to debug this. I see in both vendor.js and squarematics.js the component loading the correct files.
What I don't see is the jquery plugin loading with $.chosen. I believe there has been changes where libraries with incorrect AMD parameters are failing silently.
FYI this worked correctly on ember-cli ^0.1.15 ember 1.11. Also really not sure if this is an ember-cli-chosen issue that is just the error showing.
Thanks for your help in advance.
****** Updated ******
I was in error. There wasn't a $.chosen but there was a global Chosen.
From the chosen docs:
When set to true, Chosen will grab any classes on the original select field and add them to Chosen’s container div.
Currently, you can render out a select
input and have it rendered with the Chosen plugin, but you are not able to actually bind to the selected value.
There should be an action triggered when the selected value changes, as well as the ability to bind the select
input to a value.
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.