Skip to content

Instantly share code, notes, and snippets.

@dhindurthy
Last active August 13, 2019 16:41
Show Gist options
  • Save dhindurthy/5dbccc9686f1c0b04333345029ec8834 to your computer and use it in GitHub Desktop.
Save dhindurthy/5dbccc9686f1c0b04333345029ec8834 to your computer and use it in GitHub Desktop.
inline-and-block-component
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
import Ember from 'ember';
export default Ember.Route.extend({
model: function(){
var componentObj = {};
componentObj.post = {
"title":"is the title",
"body":"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua",
"author":"My Name"
};
return componentObj;
}
});
<TestComponent @post={{this.model.post}} as |title body author|>
{{body}}
<h3>{{title}}</h3>
<h4>{{author}}</h4>
</TestComponent>
<hr><hr>
<TestComponent @post={{this.model.post}} />
{{outlet}}
{{#if (has-block)}}
{{yield @post.title @post.body @post.author}}
{{else}}
<h1>{{@post.title}}</h1>
<p class="author">Authored by {{@post.author}}</p>
<p>{{@post.body}}</p>
{{/if}}
{
"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