Emberjs: show output on certain conditionals

I want to show some HTML blocks based on the existence of output. I tried this code but it does not work. Did I miss something?

{{#if outlet}}
    <table class="col-sm-9">
        some content
    </table>
    <table class="col-sm-3">
        {{outlet}}
    </table>
{{else}}
    <table class="col-sm-12">
        some content
    </table>
{{/if}}

EDIT:

My script, if I am on a route customers, then outletis hidden, otherwise, if I am on a route customers.create, then it is outletdisplayed. Is there an easy way to do this without touching the router.jsfile?

+4
source share
1 answer

Have you tried naming the outlet and then displaying the contents of a specific outlet in the router.

See http://emberjs.com/guides/routing/rendering-a-template/ for something like this, which is mentioned in the manual.

App.PostRoute = App.Route.extend({
  renderTemplate: function() {
      this.render('favoritePost', {   // the template to render
      into: 'posts',                // the template to render into
      outlet: 'posts',              // the name of the outlet in that template
      controller: 'blogPost'        // the controller to use for the template
  });
  this.render('comments', {
     into: 'favoritePost',
     outlet: 'comment',
     controller: 'blogPost'
    });
  }
});
0

All Articles