2017-01-08 21 views
0

私はこれをやろうとしますhttps://jsfiddle.net/u6qdfw5f/1/ angularjsを使用していますが、それは空白のままですhttps://jsfiddle.net/cs3rpy83/5/私はなぜそれが見えません。 NG-repeatがこの例によるとなぜ私のng-repeatが機能しないのですか

  <title>The W3.CSS Example</title> 
    <body ng-app ng-init="app='accordion'"> 
<div class="w3-accordion w3-light-grey"> 
<div ng-repeat= "section in sections" ng-init="sections=['section 1','section 2']"> 
    <button onclick="myFunction('Demo1')" class="w3-btn-block w3-left-align"> 
    Open Section 1 
    </button> 
    <div id="Demo1" class="w3-accordion-content w3-container"> 
    <p>Some text..</p> 
    </div> 

    </div> 


</div> 

    </body> 

答えて

2

あなたはNGリピート私がinitをしている

<div ng-init="sections=['section 1','section 2']"> 
    <div ng-repeat= "section in sections"> 
      <button onclick="myFunction('Demo1')" class="w3-btn-block w3-left-align"> 
       Open Section 1 
      </button> 
     <div id="Demo1" class="w3-accordion-content w3-container"> 
      <p>Some text..</p> 
     </div> 
    </div> 
+0

を呼び出す前に、同じ行にセクションを初期化する必要がhttps://docs.angularjs.org/api/ng/directive/ngInit しかし、私はそれを動作させるために上のdivに入れなければならないようですhttps://jsfiddle.net/cs3rpy83/6/ – user310291

関連する問題