AngularJs基礎チュートリアル(二)データのバインドと式


ここではH 5 EDU
機構公式HTML 5トレーニング
チュートリアル、AngularJs基礎チュートリアル
,AngularJsチュートリアル
angularjsについての基礎的な理解を導きます
このセクションでは、データのバインドと式について説明します.
データ初期化angularjsアプリケーションではng-init命令でデータを初期化できます



    
    
    <script src="../angular.min.js"/>


    <div ng-app="" ng-init="cost1=3;cost2=4">
        <p>   :<span ng-bind="cost1*cost2"/></p>

    </div>


</code></pre> 
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;">ng-init         ,     js  ,(num,string,array,obj...)            ,          。</span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <pre><code><div ng-app="" ng-init="str1='    ';str2='www.h5edu.cn'">--      
<div ng-app="" ng-init="person={str1:'     ',str2:'sfsf'}">--     
<div ng-app="" ng-init="points=<span>[</span>1,14,13,12,23]">--      
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;">    </span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;">angularjs             {{    }},    ng-bind    </span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <pre><code>


    <meta charset="UTF-8"/>
    <title/>
    <script src="../angular.min.js"/>


<div ng-app="" ng-init="points=<span>[</span>1,14,13,12,23]">
    <p>{{ points<span>[</span>1] }}</p>//  {{}}    
    <p><span ng-bind="points<span>[</span>2]"/></p>//  ng-bind    
</div>


</code></pre> 
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;">{{}}    ,          </span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;">ng-bind,              innerhtml</span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <span style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"> {{}} ng-bind        js    {{}}</span> 
  <br style="color:rgb(102,102,102);font-family:'Helvetica Neue', STHeiti, '    ', 'Microsoft YaHei', Helvetica, Arial, sans-serif;font-size:14px;line-height:22.4px;"/> 
  <pre><code> <div ng-app="" ng-init="str1='    ';str2='www.h5edu.cn'">
        <h3>   </h3>
        <p>{{str1+""+str2}}</p>
        <h3>ng-bind</h3>
        <p ng-bind="str1+''+str2"/>
</div></code></pre> 
 </div> 
</div>
                            </div>
                        </code></pre></div>
                    </div>
                    <!--PC WAP    -->
                     
                    <script type="text/javascript" src="/views/front/js/chanyan.js"/>
                    <!--    -         -->
                     
                </div>
                <div class="col-md-3">
                    <div class="row" id="ad">
                        <!--    -  1       -->
                        <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                             
                        </div>
                        <!--    -  2       -->
                        <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                             
                        </div>
                        <!--    -  3       -->
                        <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                             
                        </div>
                    </div>
                </div>
            </div>