Skip to content

Instantly share code, notes, and snippets.

@quaertym
Last active October 23, 2015 16:48
Show Gist options
  • Save quaertym/3793861952d44fd97fe5 to your computer and use it in GitHub Desktop.
Save quaertym/3793861952d44fd97fe5 to your computer and use it in GitHub Desktop.
localized-placeholder
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
<p>Expect to see 'Bonjour' but placeholder text is '_hello'</p>
{{localized-input placeholder="_hello_"}}
import Ember from 'ember';
Ember.STRINGS = {
'_hello_': 'Bonjour'
}
export default Ember.Component.extend({
tagName:'input',
attributeBindings: ['placeholder'],
willInsertElement: function() {
this._super();
var placeholder = this.get('placeholder');
if (placeholder) {
this.set('placeholder', placeholder.loc());
}
}
});
{
"version": "0.4.13",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment