Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- App = Ember.Application.create();
- var json_data = [
- {"color": "red"},
- {"color": "blue"}
- ];
- App.Router.map(function() {
- this.route("index", {path: '/'});
- });
- App.IndexRoute = Ember.Route.extend({
- model: function() {
- return json_data;
- }
- });
- App.IndexController = Ember.Controller.extend({
- actions: {
- clickMe: function(event) {
- // How do I log the target element? This is throwing an error
- console.log(event.target);
- }
- }
- });
- <script type="text/x-handlebars">
- <h2> Welcome to Ember.js</h2>
- {{outlet}}
- </script>
- <script type="text/x-handlebars" data-template-name="index">
- <h2>Inside Index</h2>
- <ul>
- {{#each model}}
- <li {{bind-attr class=color}} {{action 'clickMe'}}>Click here: {{color}}</li>
- {{/each}}
- </ul>
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement