0

I have an Ember app which has the concept of a "message center" and if a user click on the messages button then a modal dialog pops up and they can view their messages but meanwhile the route has not changed and therefore the backdrop of the modal window is still whatever context/route that the user was on before checking their messages. Make sense?

In order to implement this I thought I'd use the {{render}} functionality in my application.hbs, like so:

<p>PAGE HTML, ETC.</p>

{{#if showMessageCenter}}
    <div id="messageCenter">
        TESTING

        {{render messages}}
    </div>
{{/if}}

When the user clicks on "messages" the showMessageCenter attribute is flipped to true and the "TESTING" message appears but that's it. The messages template that I was expecting is not there. Further to my surprise I see this from the Ember debugger:

As you can see messages is listed under the names and an appropriate reference to the controller App.MessagesController has been established but the template is listed as "inline". How do I get this to resolve to messages.hbs?

ken
  • 8,763
  • 11
  • 72
  • 133
  • Does it have an influence if you omit your if? – mavilein Oct 01 '13 at 10:58
  • Btw the screenshot that you showed is not important here. It shows the routes in your application, but the use of the render helper does not has to do anything with a route. – mavilein Oct 01 '13 at 12:46
  • May be you can have a look at this question http://stackoverflow.com/questions/15261377/outlet-view-render-and-control-helpers/15267875#15267875 and see if this fits your understanding of the render helper. – mavilein Oct 01 '13 at 12:47
  • Well that's not completely true ... without the {{render}} the `messages` doesn't show up at all. I also thought that the "(inline)" reference might be instructive. I'll look at your link now. – ken Oct 01 '13 at 12:59
  • Maybe you can put up a little fiddle/jsbin with just the messages classes involved and i can have deeper look at it. – mavilein Oct 01 '13 at 13:08
  • Ok thanks. I have one thing I want to check first ... I'm getting the impression that I may *need* to have a View defined (I only have HBS and Controller). – ken Oct 01 '13 at 13:10
  • Ok I've sort it out. Annoyingly silly problem. It wasn't so much that a View was required but that the template file had not been initialised with a `require` in the `initialize.js` file. – ken Oct 01 '13 at 13:23
  • 2
    Talking about it always helps :-) – mavilein Oct 01 '13 at 13:30

0 Answers0