lundi 30 janvier 2017

Ember.js: param value is not set in nested route

I'm currently trying to refactor a project from legacy ember (made by Rob Connery in pluralsight) to a ember-cli project. I get the following error: This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid. I think it is the param "repoName" is not passed or set I have the following routes:

Router.map(function() {
  this.route("user", { path: "/users/:login" }, function() {
    this.route('repositories');
    this.route('repository', { path: "repositories/:repoName" } ); 
  });

The parent route "user":

return Ember.$.getJSON("http://ift.tt/1gcW4Wp" + params.login);

the two nested routes "user.repositories" and "user.repositry":

model: function (params) {
    return Ember.$.getJSON(this.modelFor('user').repos_url);
  }

model: function (params) {
    var user = this.modelFor("user");
    var url = "http://ift.tt/19e4Tso" + user.login + "/" + params.reponame;
    return Ember.$.getJSON(url);
  }

So when i try to link to a specific repository in my template:

<h4></h4>

Then nothing happens. I want to call the repository route with the current user.

I'm quite new to ember so please forgive me if the conventions is not accurate.

The whole project is about getting the git repositories from your choice of developers, see their repositories and eventually the commits, forks and issues. If you want to see the whole project and/or contribute you can find it here:

http://ift.tt/2jmDN1L




Aucun commentaire:

Enregistrer un commentaire