Element -- selects all h2
elements on the page
h2 {
foo: bar;
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: "Ember Twiddle" | |
}) |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: "ember-twiddle", | |
allItems: ['a', 'b'], | |
sortedItems: Ember.computed.sort('allItems', function(a, b) { | |
alert(this.get('columnList')); | |
}), | |
columnList: ["name","shortcode"], | |
init() { |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'checkbox example', | |
actions: { | |
setProperty() { | |
// toggle the property on click | |
this.toggleProperty("my_property"); | |
alert("checkbox value: "+this.get('my_property')); // returns true or false based on the checked value | |
} |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
active: true, | |
actions: { | |
someAction() {} | |
} | |
}); |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
name1: null, | |
name2: null, | |
init() { | |
this._super(...arguments); | |
// print initial value | |
this.set('name1', (this.get('serviceName').name)); // hello | |
// change value of name property in service |
import Ember from 'ember'; | |
import { validator, buildValidations } from 'ember-cp-validations'; | |
const validations = buildValidations({ | |
name2: validator('presence', { | |
presence: true | |
}) | |
}); | |
export default Ember.Controller.extend(validations, { | |
appName: 'Ember Twiddle' |
## nl2br Helper class for Ember > 2.0 | |
import Ember from 'ember'; | |
const { | |
Helper: { helper }, | |
String: { htmlSafe } | |
} = Ember; | |
export function nl2br([text]) { |
!!! 5 | |
%html | |
%head | |
%title Example HAML | |
/[if IE] | |
%link{ :rel => "stylesheet", :href => "/css/ie.css" } | |
%body | |
#container | |
%header | |
%h1 Our Awesome HTML5 Template |