路线中的空模型

时间:2015-11-21 13:43:29

标签: ember.js

我有以下路线:

protected void Page_Load(object sender, EventArgs e)
{

}

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{

}

protected void Button_LogIn_Click(object sender, EventArgs e)
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[@"\\MAC\HOME\DESKTOP\NIMV1.MDFConnectionString"].ConnectionString);
    conn.Open();
    string checkuser = "select count(*) from [Table] where UserName= '" + TextBoxLogIn.Text + "'";
    SqlCommand com = new SqlCommand(checkuser, conn);
    int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    conn.Close();
    if (temp == 1)
    {
       conn.Open();
        if (checkuser == TextBoxLogIn.Text)
        {
            Session["New"] = TextBoxLogIn.Text;
            Response.Write("User name is correct");
        }
        else
        { 

        Response.Write("user does not exist");
    }
        conn.Close();
    }
}

和控制器:

import Ember from 'ember';

export default Ember.Route.extend({
  ajax: Ember.inject.service(),

  queryParams: {
    search: {
      refreshModel: true
    }
  },

  beforeModel: function() {
    var params = this.paramsFor('recipes');
    var that = this;
    return new Ember.RSVP.Promise(function(resolve, reject) {
      that.get('ajax').request({
          url: "/recipes",
          method: "GET",
          data: {
            namePart: params.search
          }
        },
        function(response) {
          that.store.unloadAll("recipe");

          response.forEach(function(item) {
            that.store.push(that.store.normalize("recipe", item));
          });

          resolve();
        });
    });

  },

  model: function() {
    this.store.peekAll('recipe');
  }
});

请求成功。我甚至在商店里看到了适当的数据。但路由/控制器模型为空。我做错了什么?

1 个答案:

答案 0 :(得分:2)

您在模型中缺少edit_group_path个关键字:

/groups/:id/edit