2014-01-12 2 views
1

다음 Ember 템플릿이 있습니다.Ember에서 {{outlet}}을 변수 이름으로 사용합니다.

{{#with model}} 
<h2>Order #{{id}}</h2> 
<table> 
    <thead> 
     <tr> 
      <th>Outlet</th> 
      <th>Date</th> 
      <th>Link</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>{{outlet}}</td> 
      <td>{{date}}</td> 
      <td>{{#link-to 'next-route' this}}Go{{/link-to}}</td> 
     </tr> 
    </tbody> 
</table> 
{{/with}} 
<hr> 
{{outlet}} 

어떻게으로 전환하고있어 다음보기를 추가하는 최초의 {{outlet}}를 (단지 특성의 이름이다)를 사용에서 나는 엠버을 유지 할까?

답변

1

outlet은 완전히 자격을 얻으면 작동한다는 예약어입니다.

귀하의 경우 with 블록을 사용하면 완전히 자격을 얻을 수 없지만 with 블록을 제거하면 작동합니다.

개인적으로 나는, 나는`#의 with`을 사용했다 반복에서`model.` 비트를 유지하기 위해 for 또는

<h2>Order #{{id}}</h2> 
<table> 
    <thead> 
     <tr> 
      <th>Outlet</th> 
      <th>Date</th> 
      <th>Link</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>{{model.outlet}}</td> 
      <td>{{date}}</td> 
      <td>{{#link-to 'next-route' this}}Go{{/link-to}}</td> 
     </tr> 
    </tbody> 
</table> 
<hr> 
{{outlet}} 
+0

if라는 이름의 변수를 가진 유사, 그것은을 사용하지 않는 것입니다. 그러나 나는 그것이 하나 또는 다른 것 같아요. – alizahid

관련 문제