Reputation: 127
about this reps demo.
route:
this.resource('index',{path:'/'}, function(){
this.route('login',{path:'/login'});
this.route('signup',{path: '/signup'});
})
index
- login
- signup
index -- render index.hbs
-> index_login.hbs
index.login --render index.hbs
-> index_login.hbs
index.signup --render index.hbs
-> index_signup.hbs
I have no idea! I just want to reuse index.hbs
, but I don't how to control.
Upvotes: 0
Views: 613
Reputation: 2861
Based on your code:
<div class="well">
<h1>index</h1>
{{outlet}}
Welcome Ember.js! {{#link-to 'index.signup'}}signup{{/link-to}}
</div>
By default (not overriding route.renderTemplate), the {{outlet}} will be automatically updated when the content of index/login.hbs or index/signup.hbs when you enter on each specific route.
<script type="text/x-handlebars" data-template-name="index/login">
<script type="text/x-handlebars" data-template-name="index/singup">
To show Login when you transition to 'index' (IndexRoute), you could define your IndexRoute or IndexIndexRoute to redirect to IndexLoginRoute.
Yodemo.IndexIndexRoute = Ember.Route.extend({
beforeModel: function(transition) {
this.transitionTo('index.login');
}
});
http://emberjs.jsbin.com/titabaxe/3/edit
Upvotes: 1