Skip to content

Instantly share code, notes, and snippets.

@vigor-rus
Last active June 29, 2019 20:30
Show Gist options
  • Save vigor-rus/f3c03fbd91e6511cef814d68c20a7f43 to your computer and use it in GitHub Desktop.
Save vigor-rus/f3c03fbd91e6511cef814d68c20a7f43 to your computer and use it in GitHub Desktop.
Yield
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Route from '@ember/routing/route';
export default Route.extend({
model() {
//return this.store.findAll('post');
return [
{id: 1, title: "Article1", body: "Content1", author: "Author1"},
{id: 2, title: "Article2", body: "Content2", author: "Author2"},
{id: 3, title: "Article3", body: "Content3", author: "Author3"},
];
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<article class="blog-post">
<h1>{{this.title}}</h1>
<p>Here is yielded from: {{yield @post.title @post.body @post.author}} </p>
<label for="title">Blog Title</label>
<p>Edit title: {{input id="title" type="text" value=this.title}}</p>
</article>
<BlogPost @post={{this.model}} as |title body author|>
<h2>{{title}}</h2>
<p class="author">by {{author}}</p>
<p class="post-body">{{body}}</p>
</BlogPost>
{
"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