AngularJS学习——价格计算器
利用AngularJs实现价格计算器,总价满100免运费。(熟悉$watch的使用)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABKAAAAE0CAYAAAAblktOAAAgAElEQVR4nO3dPWxb2Zk/4Nceb6bJByZFipmJxgogMNU2y90mgQC7UMViQCymWBYE3LjiHwGBKdTdTsUAxCKs1BhgoRRTCClYqbABYrfZcJutIgiBHBoJAgSIi0k1H/Cflx8SRZH6sO+RaOd5As6I9+PcczmpfnjPe+68GgoAAAAASOTubU8AAAAAgHebAAoAAACApARQAAAAACQlgAIAAAAgKQEUAAAAAEkJoAAAAABISgAFAAAAQFICKAAAAACSEkABAAAAkJQACgAAAICkBFAAAAAAJCWAAgAAACApARQAAAAASQmgAAAAAEhKAAUAAABAUgIoAAAAAJISQL0relmUy+XhpxadwVVvKY/vqXXiircAAAAAXNu7GUANOlEbhTFZ9K58bTmySy9eIg9/XvvmIoKgQXR2u+M/K4+jvnalp8bTk1vqcaVbAAAAAF7DjQRQg07typU542vfMBC6ztyeHcRh/kepEY82X2OAPHxqdiO6zahdtfSoaL0n0R6/RDSu+BKDzm6M86dKPHyd9wYAAAC4onvpHzGIZwejdCTaT3pRzy5IOwad2B4nKSNHx4OIzZS1Ob14Mnnea1cBbWax3ziK6nCcw3Y1arEfe1crQSrITPVTHEa7Wo72RZdXWtHP4uS9I7rRLHcvumNyWz9O/9P1Iis34/K7zt6Xh4vVmf++F9wVreEk5WIAAADwbkgfQA2excGVqnMG0dlux2w8cdjejs6DvSsuKXuNqZ1UAeUFTOUrBSrjAOfse6zV96J1XI68ECoPobL12bAmrUFnO66U6czqPb3auwIAAAAUIHkAdbrEbSseXBAk9bLq6TKy/b148GxcLdOuZrGeohpmrtrqTW1m+9E4Gr9Dt1mL9f10wdmJmXeYVhqNq4xi9Bsufn5evdQ9c89JRVOpEft716kEKy15ziA6terSYKzUWFIllvfjqp4NIQEAAIC3X+IeUKfL70pbD5YGG3kT7ua0IXZrHGis1XeiUcqPdK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jh/2OBZHByWovFo+hKTcOvg2eK5XHb9dZI5wIQAAALTSURBVMcDAAAAWEH3Ch+xl0W52R3/fViNcnvxZc1yNyqtPHCaVPkcjo/nxx4+Lcd0iJk7ojx7rNSI/YVL5F7HWtQfV6Ld3I5a6XA0h4U5WB6g9eeODY7jaPiv9fzv58dxWNqKndlJ3V+P0uFxPB89Zc5l1193PAAAAIAVVGgAlTf0bkZrtOTuqteXnw6v3+tHfbLc7DjGlVCzQ5ws5btSedRa1EfjXXnSp4HZ0OHh8NMsR35kHJBddPNwztvtOKy0Ym8tL1g6iaLmjCukNucSo8Hxxdffv+T8/HgAAAAAq6jQAGoUHE2WwE0rmpYaVTDl19+yUVVTNvrzJEC7UtA105/pzdcNAgAAALyzil+CN3Fh9VBedbSb6sk3YNCJWrUdkTcjn+0Htb6x5IaNWF9QrXTZ9dcdDwAAAGAVJQug3hpzS/Bme00tDNFG1x9FY78f5/qUL+rPNOrjtB73Fz37suuvOx4AAADACkq0C96b6kV2nV3szrjmLnijJXj90adViTx1Ovl+LnzKK59G4dPe+fApt/YgtkrdaGbTPf6G79HsRmnrweKG4Zddf93xAAAAAFZQsgqo7qSR91KlxoX35dVHqxayDJ4dxGH+v2o55jf3G1dL5Q3Q9yNq1SiXx8dLjf3Ym0mr8j5Tu+vTY5ddf/l4AAAAAKvuzquhYoec7Gb3+LIeUOuxv1c/DZkmfZU2Fix7u94ueAAAAACskgQBFAAAAACcWtEeUAAAAAC8KwRQAAAAACQlgAIAAAAgKQEUAAAAAEkJoAAAAABISgAFAAAAQFICKAAAAACSEkABAAAAkJQACgAAAICkBFAAAAAAJCWAAgAAACApARQAAAAASQmgAAAAAEhKAAUAAABAUgIoAAAAAJISQAEAAACQlAAKAAAAgKQEUAAAAAAkJYACAAAAICkBFAAAAABJCaAAAAAASEoABQAAAEBSAigAAAAAkvr/qZiK8jU+jUkAAAAASUVORK5CYII=" alt="" width="964" height="250" />
代码:
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>价格计算器</title>
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css">
</head>
<body>
<div class="container" ng-controller="MyControl">
<h2>价格计算器</h2>
单价:<input type="text" class="form-control" ng-model="iphone.price">
数量:<input type="text" class="form-control" ng-model="iphone.num">
<hr>
<p>总价:{{ sum() | currency:'¥'}}</p>
<p>运费:{{ iphone.yf | currency:'¥'}}</p>
<p>合计:{{ sum() + iphone.yf | currency:'¥'}}</p>
</div>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var myAng = angular.module('myApp',[]);
myAng.controller('MyControl',function($scope){
$scope.iphone = {
price:10,
num:1,
yf:10
}
$scope.sum = function(){
return $scope.iphone.price*$scope.iphone.num
}
// $watch监控对象为属性时,不加$scope
$scope.$watch('iphone.num',function(newvalue,oldvalue){
console.log('新值:'+ newvalue +';旧值:'+ oldvalue)
})
// $watch监控对象为方法时,加$scope
$scope.$watch($scope.sum,function(newvalue,oldvalue){
return $scope.iphone.yf = newvalue >= 100 ? 0 : 10;
})
})
</script>
</body>
</html>
AngularJS学习——价格计算器的更多相关文章
- AngularJS学习笔记二:AngularJS指令
AngularJS 指令: AngularJS 通过被称为 指令 的新属性来扩展 HTML. AngularJS 指令是扩展的 HTML 属性,带有前缀 ng-. 几个常用 指令: ng-app 指令 ...
- AngularJS学习之旅—AngularJS 指令(三)
1.AngularJS 指令 AngularJS 通过被称为 指令 的新属性来扩展 HTML. AngularJS 通过内置的指令来为应用添加功能. AngularJS 允许你自定义指令.2.Angu ...
- Angularjs学习---官方phonecat实例学习angularjs step0 step1
接下来一系列的文章都是学习https://docs.angularjs.org/tutorial的笔记,主要学习的angular-phonecat项目的实现,来介绍angularjs的使用. 1.下载 ...
- angularJS学习资源最全汇总
基础 官方: http://docs.angularjs.org angularjs官方网站已被墙,可看 http://www.ngnice.com/: 官方zip下载包 https://github ...
- 我的AngularJS 学习之旅
我的AngularJS 学习之旅 基础篇 1.Angular的 起源 2.比较Web 页面实现的几种方式 3.一些基本术语 4.Angular与其他框架的兼容性 5.总结 6.综合实例 很早之前就 ...
- 推荐10个很棒的AngularJS学习指南
AngularJS 是非常棒的JS框架,能够创建功能强大,动态功能的Web app.AngularJS自2009发布以来,已经广泛应用于Web 开发中.但是对想要学习Angular JS 的人而言,只 ...
- Angularjs学习---ubuntu12.04中karma安装配置中常见的问题总结
karma启动时出现了很多问题: 1.安装karma前提条件 安装karma首先要安装nodejs,npm然后才可以安装karma.nodejs,npm的安装过程可以参考文章:Angularjs学习- ...
- AngularJs学习总结-了解基本特性(-)
现在的前端项目中基本上都会用到angularjs框架,之前并不了解这个框架,也是因为最近接手的项目,所以打算好好的学习下它.之前都是搞pc端,现在接手的是移动端的项目,移动端UI框架用的是ionic+ ...
- [整理]AngularJS学习资源
https://angular.io/docs/js/latest/(2.0官方网站) http://www.linuxidc.com/Linux/2014-05/102139.htm(Angular ...
随机推荐
- 浅谈CPU、内存、硬盘之间的关系
计算机,大家都知道的,就是我们日常用的电脑,不管台式的还是笔记本都是计算机.那么这个看着很复杂的机器由哪些组成的呢,今天就简单的来了解一下. 先放图: 图上展示的就是计算机的基本组成啦. 首先是输入设 ...
- javaScript中两个等于号和三个等于号之间的区别
一言以蔽之:==先转换类型再比较,===先判断类型,如果不是同一类型直接为false. ===表示恒等于,比较的两边要绝对的相同 alert(0 == ""); // trueal ...
- js经典试题之闭包
js经典试题之闭包 1:以下代码输出的结果是? function Foo(){ var i=0; return function(){ document.write(i++); } } var f1= ...
- C语言实验——时间间隔
Description 从键盘输入两个时间点(24小时制),输出两个时间点之间的时间间隔,时间间隔用“小时:分钟:秒”表示. 如:3点5分25秒应表示为--03:05:25.假设两个时间在同一天内,时 ...
- Oil Deposits(DFS连通图)
Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...
- 软件工程 作业part2 采访
Part 2 采访本课程往届同学(含外校和毕业生). 现代软件工程这门课已经上了好几年了,以前有很多学生做过团队项目(说不定包括本校的学生),请你们找一个以前的团队采访一下. 我采访的是2016级于淼 ...
- block知识总结
一.block在内存中存在的形式 1.当把block句法写在函数或者方法外面时,系统会在静态数据区分配一块内存区域给block对象.这片区域在程序执行期会一直存在. 2.当block句法写在函数或者方 ...
- 模拟Excel同一列相同值的单元格合并
背景 项目中有一个查询工作量,可以将查询的结果导出到Excel表中.在Excel工具中,有一个合并居中功能,可以将选中的单元格合并成一个大的单元格.现在需要在程序中直接实现查询结果的汇总, 问题分析 ...
- iOS- 网络访问两种常用方式【GET & POST】实现的几个主要步骤
1.前言 上次,在博客里谈谈了[GET & POST]的区别,这次准备主要是分享一下自己对[GET & POST]的理解和实现的主要步骤. 在这就不多废话了,直接进主题,有什么不足的欢 ...
- 【week2】四人小组项目(WBS、NABCD)
项目选题:东北师范大学论坛 小组名称:nice! 项目组长:李权 组员:于淼 刘芳芳 杨柳 本周任务:要求给出需求概述.功能列表.痛点或亮点.NABCD及WBS模型在此项目中的应用. 作为东北师范大学 ...