Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A helper named could not be found when trying to render component in Ember

Tags:

ember.js

I have the following router setup:

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"});
    });
  });
});

And, in templates/projects/show.hbs, I'd like to render the component for creating a new task ( the component is automatically generated by ember, but I have my own template and controllers at controllers/projects/tasks/new.js and templates/projects/tasks/new.hbs ). I tried the following:

  {{tasks/new model=model}}

But I receive this error:

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

What is the proper way of fixing this?

like image 231
Geo Avatar asked Oct 18 '22 14:10

Geo


1 Answers

{{tasks/new here task/new can be a Component or Helper but can't be template hbs. If you want to include tasks/new inside templates/projects/show.hbs then I would encourage you to create component for tasks/new and include it where ever you require.

You can give it try by mentioning different templateName for template hbs. using templateName property. Inside show.js route file define templateName: 'projects/tasks/new'

like image 90
Ember Freak Avatar answered Oct 21 '22 08:10

Ember Freak