2014-09-25 3 views
4

콘센트의 존재 여부에 따라 HTML 블록을 보여주고 싶습니다. 이 코드를 시도했지만 작동하지 않습니다. 내가 놓친 게 있니?Emberjs : 특정 조건의 콘센트보기

{{#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}} 

편집 : 나는 경로 customers에있어 경우

내 시나리오는 다음 outlet 나는 쇼가 outlet입니다 다음 경로 customers.create에있어 다른 경우, 숨겨진입니다. 거기에 아무 것도 할 수있는 간단한 방법이 있나요 router.js 파일?

답변

0

콘센트의 이름을 지정하고 라우터의 특정 콘센트의 내용을 렌더링 해 보았습니까?

http://emberjs.com/guides/routing/rendering-a-template/ 가이드에 언급 된 내용을 참조하십시오.

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' 
    }); 
    } 
}); 
+1

내 업데이트 된 질문보기 전에 콘센트의 이름을 알려주지 않습니다. 그런데, 'router.js' 파일을 터치하지 않고 그것을 할 수있는 간단한 방법이 있습니까? – user3741665