亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        AngularJS入門教程之AngularJS表達式

        字號:


            表達式用于應用程序數據綁定到HTML。表達式都寫在雙括號就像{{表達式}}。表達式中的行為跟ng-bind指令方式相同。 AngularJS應用表達式是純javascript表達式,并輸出它們被使用的數據在那里。
            AngularJS表達式格式 : {{expression }}
            AngularJS表達式可以是字符串、數字、運算符和變量
            數字運算{{1 + 5}}
            字符串連接{{ 'abc' + 'bcd' }}
            變量運算 {{ firstName + " " + lastName }}, {{ quantity * cost }}
            對象{{ person.lastName }}
            數組{{ points[2] }}
            AngularJS例子
            1.Angularjs數字
            <div ng-app="" ng-init="quantity=2;cost=5">
            <p>總價: {{ quantity * cost }}</p>
            </div>
            上例輸出:
            總價:10
            代碼注釋:
            ng-init="quantity=2;cost=5" //相當于javascript里的var quantity=2,cost=5;
            使用ng-bind可以實現(xiàn)相同的功能
            <div ng-app="" ng-init="quantity=1;cost=5">
            <p>總價: <span ng-bind="quantity * cost"></span></p>
            //這里的ng-bind相當于指定了span的innerHTML
            </div>
            2.Angularjs字符串
            <div ng-app="" ng-init="firstName='John';lastName='Snow'">
            <p>姓名: {{ firstName + " " + lastName }}</p>
            </div>
            輸出
            姓名:Jone Snow
            3. AngularJS對象
            <div ng-app="" ng-init="person={firstName:'John',lastName:'Snow'}">
            <p>姓為 {{ person.lastName }}</p>
            </div>
            輸出
            姓為 Snow
            4.AngularJS數組
            <div ng-app="" ng-init="points=[1,15,19,2,40]">
            <p>第三個值為 {{ points[2] }}</p>
            </div>
            輸出
            第三個值為 19
            以上所述是小編給大家介紹的AngularJS入門教程之AngularJS表達式的相關介紹,希望對大家有所幫助!