2017-04-02 4 views
2

でコンポーネントをレンダリングしようとしたとき、私は、次のルータを設定している見つかりませんでした。という名前のヘルパーはエンバー

Router.map(function() { 
    this.route("login"); 
    this.route("dashboard"); 
    this.route("projects", function() { 
    this.route("show", {path: "/:project_id"}); 

    this.route('tasks', {path: "/:project_id/tasks" },function() { 
     this.route('new', {path: "/new"}); 
     this.route('show', {path: "/:task_id"}); 
    }); 
    }); 
}); 

そして、templates/projects/show.hbsに、私は(新しいタスクを作成するためのコンポーネントをレンダリングしたいのですがコンポーネントはemberによって自動的に生成されますが、私自身のテンプレートとコントローラはcontrollers/projects/tasks/new.jstemplates/projects/tasks/new.hbsです。

{{tasks/new model=model}} 

しかし、私はこのエラーが表示されます:私は、次のことを試してみました

Assertion Failed: A helper named "tasks/new" could not be found 

これを固定する適切な方法は何ですか?

答えて

2

{{tasks/newここでtask/newは、コンポーネントまたはヘルパーにすることはできますが、テンプレートhbsにすることはできません。 tasks/newtemplates/projects/show.hbsに含める場合は、tasks/newのコンポーネントを作成し、必要な場所にそのコンポーネントを含めることをおすすめします。

テンプレートhbsに別のtemplateNameを記述することで試してみることができます。 templateNameプロパティを使用します。 内部show.jsルートファイル定義templateName: 'projects/tasks/new'

関連する問題