编辑模板未显示在编辑路线上 [英] edit template not displaying on edit route

查看:69
本文介绍了编辑模板未显示在编辑路线上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编辑用户。我正在关注此教程: http: //coding.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js/

I would like to edit users. I am following this tutorial: http://coding.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js/

我有一个 user.hbs 中的按钮来编辑用户:

I have a button in user.hbs to edit the user:

< button {{ edit}}> Edit< / button> 及其下面是 {{outlet}}

单击时,我被定向到 /index.html#/users/4/edit ,但我的 user.edit .hbs 模板未显示

When click it I'm directed to /index.html#/users/4/edit but my user.edit.hbs template does not show up

这是 userEditRoute.js

App.UserEditRoute = Ember.Route.extend({
  model: function(){ 
    return this.modelFor('user');
  }
});

userController.js

App.UserController = Ember.ObjectController.extend({
  actions: {
    edit: function(){
      this.transitionToRoute('user.edit');
    }
});

为什么 user.edit.hbs 显示?

推荐答案

我们可以通过以下方式进行操作。
请检查此 BIN

We can do it in the following way. Kindly check this BIN

这篇关于编辑模板未显示在编辑路线上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆