vendredi 7 août 2015

How to pass arbitrary data to render in an Ember template?

So we're trying to render custom content into a template.

We have this template:

<div class="modal-container">
  <div class="popup modal error">
    <header>
      <p>Error!</p>
      <div class="close" {{action 'closeModal'}}>
        <i class="fa fa-close"></i>
      </div>
    </header>
    <div class="content">
      {{message}}
    </div>
  </div>
</div>

.. with this application route:

App.ApplicationRoute = Ember.Route.extend
  actions:

    displayError: (message) ->
      @render 'error-modal', 
        into: 'application'
        outlet: 'error-modal'
        model: Ember.Object.create message: message

And in our controller we're calling:

@send 'displayError', 'Error message.'

The modal pops up just fine, but the message isn't being rendered. What are we doing wrong?




Aucun commentaire:

Enregistrer un commentaire