初始AngularJS

<!--

AngularJS 通过 ng-directives 扩展了 HTML。

ng-app 指令定义一个 AngularJS 应用程序。

ng-model 指令把元素值(比如输入域的值)绑定到应用程序。

ng-bind 指令把应用程序数据绑定到 HTML 视图。

AngularJS 表达式写在双大括号内:{{ expression }}

-->

HTML5 允许扩展的(自制的)属性,以 data- 开头。
AngularJS 属性以 ng- 开头,但是您可以使用 data-ng- 来让网页对 HTML5 有效。

<div data-ng-app="" data-ng-init="mySwitch=true">

        <input type="button" data-ng-disabled="mySwitch" data-ng-click="count=count+1" value="点啊"/>

        <input type="checkbox" data-ng-model="mySwitch" />

        <input type="text" data-ng-show="mySwitch" />

        <p data-ng-bind="mySwitch"></p>

        <p>{{count}}</p>

    </div>
<script src="//www.w3cschool.cc/try/angularjs/1.2.5/angular.min.js"></script>

 

 

 

参考:http://www.w3cschool.cc/angularjs/angularjs-expressions.html
学习视频:http://down.51cto.com/zt/5851

你可能感兴趣的:(AngularJS)