Created
May 11, 2014 20:08
-
-
Save givanse/eed7f3401ed6be30689e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Cascading lists</h2> | |
Path: <b>{{currentPath}}</b><br><br> | |
{{#link-to 'widgets'}}Widgets{{/link-to}} | |
{{#link-to 'level_a'}}Lvl A{{/link-to}} | |
<br><br> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<h1>Index</h1> | |
</script> | |
<script type="text/x-handlebars" data-template-name="widgets"> | |
<h1>Widgets</h1> | |
Render template, but the model/controller? is not triggered.<br><br> | |
{{outlet a}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="level_a"> | |
Level A | |
<ul> | |
{{#each feature in model}} | |
<li>{{feature.name}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = Ember.Application.create(); | |
App.Router.map(function () { | |
this.route('widgets'); | |
this.route('level_a'); | |
}); | |
App.WidgetsRoute = Ember.Route.extend({ | |
renderTemplate: function() { | |
this._super(); | |
this.render('level_a', { | |
into: 'widgets', | |
outlet: 'a'}); | |
} | |
}); | |
App.LevelARoute = Ember.Route.extend({ | |
model: function (params) { | |
var featuresList = [ | |
{id: 0, name: "blue"}, | |
{id: 1, name: "red"} | |
]; | |
return featuresList; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment