2012-09-05 4 views
0

내가 템플릿 다음에 표시 할 형식Dust.Js 섹션과 경로

error = [{field:'one', desc:'This is error for field one', value='FromPostFieldOne'}, 
     {field:'two', desc:'This is error for field two', value='FromPostFieldTwo'}]; 

다음 오류 JSON을받을

{#error} 
<form> 
    <input type="text" name="one" id="one" value="<!- value for field one from JSON-->"/> 
    <!-- Display error from JSON for field one here --> 

    <input type="text" name="two" id="two" value="<!- value for field two from JSON -->"/> 
    <!-- Display error from JSON for field two here --> 

</form> 
{/error} 

내가 함께 내가 이것을 달성하면 알아낼 수 없습니다입니다 ether "명시 적 컨텍스트 설정"또는 "{@if cond ="condition "} 도우미". Linkedin Dust 사이트의 모든 예제는 JSON 키 값을 사용하지만 객체 배열을 사용하여이를 수행하는 방법을 보여줍니다.

도움말 감사합니다 !!!!

답변

1

당신의 JSON은이 같은해야 유효하지 않습니다

error = [ 
      { 
      field:'one', 
      desc:'This is error for field one', 
      value:'FromPostFieldOne' 
      }, 
      { 
      field:'two', 
      desc:'This is error for field two', 
      value:'FromPostFieldTwo'} 
     ]; 
+0

를 수정을! 실수를 지적 해 주셔서 감사합니다. –

관련 문제