Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created February 18, 2019 15:09
Show Gist options
  • Save GavinJoyce/d6d48f4d324fe66815a93af4a5d95d14 to your computer and use it in GitHub Desktop.
Save GavinJoyce/d6d48f4d324fe66815a93af4a5d95d14 to your computer and use it in GitHub Desktop.
with vs let
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>\{{with}} vs \{{let}}</h1>
<button onclick={{action (mut showThing) true}}>Show</button>
<button onclick={{action (mut showThing) false}}>Hide</button>
<h3>With:</h3>
{{#with showThing as |isShowing|}}
showThing: {{showThing}}
{{else}}
not showing...
{{/with}}
<h3>Let:</h3>
{{#let showThing as |isShowing|}}
showThing: {{isShowing}}
{{/let}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment