Skip to content

Instantly share code, notes, and snippets.

@mariechatfield
Last active December 19, 2017 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariechatfield/14b844d745919b7be1e3a13c744d2800 to your computer and use it in GitHub Desktop.
Save mariechatfield/14b844d745919b7be1e3a13c744d2800 to your computer and use it in GitHub Desktop.
Links Examples
import Ember from 'ember';
import links from '../config/links';
export default Ember.Component.extend({
links
});
import Ember from 'ember';
import links from '../config/links';
export default Ember.Component.extend({
links: null,
init(...args) {
this._super(args);
this.set('links', links);
}
});
import Ember from 'ember';
import links from '../config/links';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
links
});
<ul>
<li>Link with interpolation: <a href="{{links.DOCSITE}}/api">{{links.DOCSITE}}/api</a></li>
<li>Link defined in other file: <a href={{links.FOO}}>{{links.FOO}}</a></li>
</ul>
{{passed-directly}}
{{set-on-init}}
<br>
<br>
<h2>Links (passed directly):</h2>
<ul>
{{#each-in links as |key value|}}
<li><strong>{{key}}:</strong> {{value}}</li>
{{/each-in}}
</ul>
<strong>Change links.FOO:</strong>
<input value={{links.FOO}} onChange={{action (mut links.FOO) value="target.value"}}>
<h2>Links (set on init):</h2>
<ul>
{{#each-in links as |key value|}}
<li><strong>{{key}}:</strong> {{value}}</li>
{{/each-in}}
</ul>
<strong>Change links.FOO:</strong>
<input value={{links.FOO}} onChange={{action (mut links.FOO) value="target.value"}}>
{
"version": "0.12.1",
"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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment