Skip to content

Error when loading deep link with live data  #9

Open
@scottjbarr

Description

@scottjbarr

If you switch to using live data as the video shows, when you hit a "deep link" directly rather than navigating to it, you get an error.

Per the video, change the post route to...

App.PostsRoute = Ember.Route.extend({
  model: function() {
    return $.getJSON('http://tomdale.net/api/get_recent_posts/?callback=?').then(function(data) {
      return data.posts.map(function(post) {
        post.body = post.content;
        return post;
      });
    });
  }
});

Now go direct (don't navigate via the UI) to /index.html#/posts/875

You will see the following error in the console...

Error while loading route: 
ReferenceError {stack: (...), message: "posts is not defined"}

I thought that posts was a Promise?

How do you get around this in Ember.js ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions