Skip to content

Instantly share code, notes, and snippets.

@Panman82
Last active October 14, 2016 16:08
Show Gist options
  • Save Panman82/049d30a88deb59b6a4d959e75184ee61 to your computer and use it in GitHub Desktop.
Save Panman82/049d30a88deb59b6a4d959e75184ee61 to your computer and use it in GitHub Desktop.
Using helpers in an attribute
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
filename: 'some.pdf'
});
import Ember from 'ember';
export function rooturl(/*params, hash*/) {
return '/myapp/';
}
export default Ember.Helper.helper(rooturl);
<h1>Welcome to {{appName}}</h1>
<p><strong>rooturl:</strong> {{rooturl}}</p>
<p><strong>filename:</strong> {{filename}}</p>
<a href="{{concat (rooturl) filename}}">{{filename}}</a>
{
"version": "0.10.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment