Skip to content

Instantly share code, notes, and snippets.

@yaobind
Created July 17, 2018 22:19
Show Gist options
  • Save yaobind/d65fa55ddb07dade0afffcb4256ee48b to your computer and use it in GitHub Desktop.
Save yaobind/d65fa55ddb07dade0afffcb4256ee48b to your computer and use it in GitHub Desktop.
test component helper
import Ember from 'ember';
export default Ember.Component.extend({
componentName: "inner-component",
actions: {
handleComponentChange() {
this.set('componentName', "second-component");
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'EmberTwiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{yield
(hash
body=(component componentName)
)
(hash
onRename=(action "handleComponentChange")
)
}}
this is container
{{yield}}
<p>This is child componet ahah</p>
{{yield}}
<p>this is second one</p>
{{#container-component
as |subComponent actions|
}}
{{subComponent.body}}
<button {{action actions.onRename}}>change component</button>
{{/container-component}}
{
"version": "0.15.0",
"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.1.3",
"ember-template-compiler": "3.1.3",
"ember-testing": "3.1.3"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment