Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js 从控制器转换到路由时出现问题_Ember.js - Fatal编程技术网

Ember.js 从控制器转换到路由时出现问题

Ember.js 从控制器转换到路由时出现问题,ember.js,Ember.js,我有一个名为application.js的控制器,我完成了以下代码: setSectionAppForEmailPDF:function(currentCompnay,CurrentProperty,currentSection,currentPage) { this.set("currentPage", currentPage); var that = this; this.set('currentSection', currentSection

我有一个名为application.js的控制器,我完成了以下代码:

setSectionAppForEmailPDF:function(currentCompnay,CurrentProperty,currentSection,currentPage)  

{  
     this.set("currentPage", currentPage);  
     var that = this;  
     this.set('currentSection', currentSection);
     var path = "/" + currentCompnay + "/" +CurrentProperty+"/"+currentSection; // Path == '/trilok/pathak Test/test'
     this.transitionToRoute(path);  //does not call the route ,not working   //this.transitionTo(path);     //does not call the route ,not working
}

路线代码::

App.TestRoute = App.PageBaseRoute.extend  

({   
     model: function() {},  
     setupController: function(controller, model) {  
     controller.set("test", 1);  
     this._super(controller, model); },  
})    
路由的定义如下所示:

App.Router.map(function(){  
      this.resource("test",{path:"/:company_id/:property_id/test"});  
    });    
从所有定义的代码以及注释的代码中,我无法调用路由


有谁能告诉我我哪里出了问题

transitionToRoute
中,使用路线的名称,而不是路径。在上面的例子中,这就是“测试”

更新,2015-05-08

您试图解决的问题(使用动态分段布线)是一个常见且有充分文档记录的主题。您可以在找到很好的文档,还有另一个stackoverflow问题,在中有一个很好的示例

=>检查该问题的已接受答案。这正是你想要做的


希望这能有所帮助。

我已经尝试过了,但仍然没有得到任何积极的结果。你能进一步指导我吗??非常重要的是更新我的答案。希望这能让你更进一步。正如我在这里所说的,对于您试图解决的特定问题,您应该可以找到大量的示例。是的,我已经更改了代码,您的评论非常有用。感谢您的帮助并继续帮助!!!!