码迷,mamicode.com
首页 > Web开发 > 详细

AngularJS 简单使用实例,W3C

时间:2015-03-02 18:54:42      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>

<body>

<div ng-app="">
  <p>在输入框中尝试输入:</p>
  <p>姓名:<input type="text" ng-model="name"></p>
  <p ng-bind="name"></p>
</div>
<div ng-app="" ng-init="quantity=1;cost=5">
<p>总价: {{ quantity * cost }}</p>
</div>

<div ng-app="" ng-init="quantity=1;cost=5">
<p>总价: <span ng-bind="quantity * cost"></span></p>
</div>

<div ng-app="" ng-init="firstName=‘John‘;lastName=‘Doe‘">
<p>姓名: {{ firstName + " " + lastName }}</p>
</div>

<div ng-app="" ng-init="firstName=‘John‘;lastName=‘Doe‘">
<p>姓名: <span ng-bind="firstName + ‘ ‘ + lastName"></span></p>
</div>

<div ng-app="" ng-init="person={firstName:‘John‘,lastName:‘Doe‘}">
<p>姓为 {{ person.lastName }}</p>
</div>

<div ng-app="" ng-init="person={firstName:‘John‘,lastName:‘Doe‘}">
<p>姓为 <span ng-bind="person.lastName"></span></p>
</div>

<div ng-app="" ng-init="points=[1,15,19,2,40]">
<p>第三个值为 {{ points[2] }}</p>
</div>

<div ng-app="" ng-init="points=[1,15,19,2,40]">
<p>第三个值为 <span ng-bind="points[2]"></span></p>
</div>


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

</body>
</html>

AngularJS 简单使用实例,W3C

标签:

原文地址:http://www.cnblogs.com/18ge/p/4309351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!