0
votes

Due to my build tool of choice currently I cannot name templates with slashes (like ads/index). This is hopefully going to change soon, but I'm interested what's wrong with my app anyway.

Here're my routes:

App.Router.map ->
  @resource 'ads', ->
    @route 'index', path: '/'
    @route 'create'

I also have App.AdsRoute and App.AdsController defined (their content most probably doesn't matter, currently they fetch data for the ads.index — a list of ads).

My ads template only contains an outlet

= outline

(it's Emblem)

Finally, I have an ads_index and ads_create templates with some meaningful content. Now I obviously want them to render when visiting #/ads and #/ads/create respectively.

So, first I define

AdsView: Ember.View.extend
    templateName: 'ads_index'

Now when I visit #/ads it shows what I need. But when I click a link to ads.create it still shows the same ads list but the links get the 'active' class.

I assume that AdsView worked as a wildcard view for the whole ads resource.

So, I renamed all the things: AdsRoute -> AdsIndexRoute, AdsController -> AdsIndexController, AdsView -> AdsIndexView.

Now the page is empty. I see the router and controller are still doing their job sending the proper AJAX request. But the view is not rendering. What's wrong?

2

2 Answers

0
votes

If you use the log helper and log this:

{{log this}}

Are you able to view the properties of the model you're passing to the view? It might help to throw this in a jsFiddle so we can debug it.

0
votes

Stupid me. It was a typo in "ads.emblem" - outline instead of outlet.