Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<meta name="description" content="[SO] Ember's Router for pre4" />
  <script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
  <script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-pre.4.js"></script>
  <script src="http://f.cl.ly/items/2y0X3M0F2K2O1W1O1w0f/ember-data.js">
  </script>
</head>
<body>
  
<script type="text/x-handlebars" data-template-name="site-template">
  This is the site template
    {{#linkTo 'about'}}about{{/linkTo}}
     {{#linkTo 'team'}}team{{/linkTo}}
</script>
  
  <script type="text/x-handlebars" data-template-name="about">
  This is the about page
</script>
  
    <script type="text/x-handlebars" data-template-name="team">
  This is the team page
    {{#linkTo 'team.bob'}}bob{{/linkTo}}
</script>
  
  <script type="text/x-handlebars" data-template-name="bob">
  This is the bob page
</script>
  
<script type="text/x-handlebars">
  This is the application template
  {{outlet}}
</script>
  
</body>
</html>
 
App = Ember.Application.create({
  ApplicationView: Ember.View.extend({
    templateName: 'application'
  }),
  ApplicationController: Ember.Controller.extend({
  }),
  SiteView: Em.View.extend({
    templateName: 'site-template'
  }),
  SiteController: Em.ArrayController.extend(),
  
  AboutView: Em.View.extend({
    templateName: 'about'
  }),
  AboutController: Em.ObjectController.extend(),
  TeamView: Em.View.extend({
    templateName: 'team'
  }),
  TeamController: Em.ObjectController.extend(),
  BobView: Em.View.extend({
    templateName: 'bob'
  }),
  BobController: Em.ObjectController.extend()
});
App.Router.map(function() {
  this.route("site", { path: "/" });
  this.route("about");
  this.resource("team", function(){
    this.route("bob");
  });
});
App.TeamBobRoute = Ember.Route.extend({
  renderTemplate:function(){
    this.render('bob',{
      into:'application'
    });
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
rkenpro
0viewers