Skip to content

Instantly share code, notes, and snippets.

@aaronbhansen
aaronbhansen / example-key-value.hbs
Last active January 11, 2018 17:12
Ember Power Select - Semantic UI
{{! templates/example-key-value.hbs }}
{{! In this example we are selecting from the countries array by key (iso3) and setting the selected country key (iso3) as the value }}
{{! This would be used in query params where the value is text in the end and we need to translate back and forth from text to model and back}}
{{#power-select
placeholder="Select Country"
selected=(get-selected country_iso3 countries "iso3")
options=countries
onchange=(action (set-selected "country_iso3" "iso3"))
as |country|
}}
import Ember from 'ember';
export default Ember.Mixin.create({
activate() {
this._super(...arguments);
var cssClass, root;
cssClass = this.toCssClass();
root = this.root();
if (cssClass !== 'application') {
root.addClass(cssClass);
@aaronbhansen
aaronbhansen / component.js
Created May 15, 2016 22:25
UI Field helper {{ui-field}}
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['field'],
classNameBindings: ['is_error:error'],
model: null, // Model object being passed in
property: null, // The specific property on the model to look for
submitted: false,
show_error: true,