关于这个代表演示 。
路线:
this.resource('index',{path:'/'}, function(){ this.route('login',{path:'/login'}); this.route('signup',{path: '/signup'}); })指数
- 登录
- 注册
index - render index.hbs - > index_login.hbs
index.login --render index.hbs - > index_login.hbs
index.signup --render index.hbs - > index_signup.hbs
我不知道! 我只想重用index.hbs ,但我不知道如何控制。
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.
最满意答案
根据您的代码:
<div class="well"> <h1>index</h1> {{outlet}} Welcome Ember.js! {{#link-to 'index.signup'}}signup{{/link-to}} </div>默认情况下(不覆盖route.renderTemplate),当您在每个特定路由上输入时, {{outlet}}将在index / login.hbs或index / signup.hbs的内容时自动更新。
<script type="text/x-handlebars" data-template-name="index/login"> <script type="text/x-handlebars" data-template-name="index/singup">要在转换为“index”(IndexRoute)时显示“登录”,可以定义IndexRoute或IndexIndexRoute以重定向到IndexLoginRoute。
Yodemo.IndexIndexRoute = Ember.Route.extend({ beforeModel: function(transition) { this.transitionTo('index.login'); } });http://emberjs.jsbin.com/titabaxe/3/edit
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
更多推荐
发布评论