Skip to content

Instantly share code, notes, and snippets.

@dariushoule
Created September 15, 2015 16:37
Show Gist options
  • Save dariushoule/c1b730b541157d7be5ab to your computer and use it in GitHub Desktop.
Save dariushoule/c1b730b541157d7be5ab to your computer and use it in GitHub Desktop.
Ember obj example
// --- Controller
App.ApolloExampleController = Ember.ObjectController.extend({
exampleRender: []
});
// --- Helper, example of something that could happen on click
viewCtx.controller.set('exampleRender', [
{"a": "this is a1!", "b": "this is b1!"},
{"a": "this is a2!", "b": "this is b2!"}
]);
$('#myModal').modal('show');
// --- HBS
<div class="container">
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 style="color:red;"><span class="glyphicon glyphicon-lock"></span> Example</h4>
</div>
<div class="modal-body">
{{#each item in exampleRender}}
{{item.a}} | {{item.b}}<br/>
{{else}}
No Items
{{/each}}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default btn-default pull-left" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> OK</button>
</div>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment