angular js 球星
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Title</title> | |
| <style> | |
| table{ | |
| border-collapse: collapse; | |
| } | |
| </style> | |
| <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> | |
| <script> | |
| var myapp=angular.module("myapp",[]); | |
| myapp.controller("myCtrl",function($scope){ | |
| $scope.users=[ | |
| { | |
| 'url':"images/1.png", | |
| 'name':"Westbrook", | |
| 'wz':"得分后卫(SG)", | |
| "age":24, | |
| "qd":"雷霆", | |
| "page":1900 | |
| }, | |
| { | |
| 'url':"images/2.png", | |
| 'name':"James", | |
| 'wz':"大前锋(PF)", | |
| "age":23, | |
| "qd":"骑士", | |
| "page":1900 | |
| }, | |
| { | |
| 'url':"images/3.png", | |
| 'name':"Curry", | |
| 'wz':"得分后卫(SG)", | |
| "age":30, | |
| "qd":"勇士", | |
| "page":1800 | |
| }, | |
| { | |
| 'url':"images/4.png", | |
| 'name':"Harden", | |
| 'wz':"小前锋(SG)", | |
| "age":13, | |
| "qd":"火箭", | |
| "page":1800 | |
| }, | |
| { | |
| 'url':"images/5.png", | |
| 'name':"Durant", | |
| 'wz':"得分后卫(SG)", | |
| "age":35, | |
| "qd":"勇士", | |
| "page":1712 | |
| } | |
| ]; | |
| //年龄范围过滤 | |
| $scope.ageSize="--请选择--"; | |
| $scope.fun=function(){ | |
| console.log($scope.ageSize); | |
| }; | |
| $scope.ageFilter=function(item){ | |
| //console.log(item.age); | |
| if($scope.ageSize!="--请选择--"){ | |
| var ageSize=$scope.ageSize; | |
| var ageArr=ageSize.split("-"); | |
| var min=ageArr[0]; | |
| var max=ageArr[1]; | |
| var age=item.age; | |
| if(age>max||age<min){ | |
| return false | |
| }else{ | |
| return true; | |
| } | |
| }else{ | |
| return true; | |
| } | |
| }; | |
| $scope.add=function(user){ | |
| console.log(user); | |
| user.page++; | |
| }; | |
| $scope.addNew=function(){ | |
| $scope.users.push({'url':"images/5.png",'name':$scope.name,'wz':$scope.wz,"age":$scope.age,"qd":$scope.team,"page":0}) | |
| }; | |
| }) | |
| </script> | |
| </head> | |
| <body ng-app="myapp" ng-controller="myCtrl"> | |
| <div> | |
| <h2>添加新球员</h2> | |
| <div>姓名:<input type="text" ng-model="name"></div> | |
| <div>位置:<input type="text" ng-model="wz"></div> | |
| <div>年龄:<input type="text" ng-model="age"></div> | |
| <div>球队:<input type="text" ng-model="team"></div> | |
| <button ng-click="addNew()">添加新球员</button> | |
| </div> | |
| <h3>用户信息表</h3> | |
| <div> | |
| <input placeholder="用户名查询" size="10" /> | |
| <!--<input ng-model="ageSize" placeholder="年龄查询(a-b)" size="10"/>--> | |
| 年龄: | |
| <select ng-model="ageSize"> | |
| <option>--请选择--</option> | |
| <option>11-20</option> | |
| <option>21-30</option> | |
| <option>31-40</option> | |
| <option>41-50</option> | |
| <option>51-60</option> | |
| </select> | |
| </div> | |
| <div> | |
| <table border="1" cellpadding="10"> | |
| <thead> | |
| <tr> | |
| <th>球员</th> | |
| <th>姓名</th> | |
| <th>位置</th> | |
| <th>年龄</th> | |
| <th>球队</th> | |
| <th>得票数</th> | |
| <th>操作</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr ng-repeat="user in users|filter:ageFilter" > | |
| <td><img src="{{user.url}}"></td> | |
| <td>{{user.name}}</td> | |
| <td>{{user.wz }}</td> | |
| <td>{{user.age}}</td> | |
| <td>{{user.qd }}</td> | |
| <td>{{user.page}}</td> | |
| <td><button ng-click="add(user)">投票</button></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </body> | |
| </html> |
angular js 球星的更多相关文章
- MVC、MVP、MVVM、Angular.js、Knockout.js、Backbone.js、React.js、Ember.js、Avalon.js、Vue.js 概念摘录
注:文章内容都是摘录性文字,自己阅读的一些笔记,方便日后查看. MVC MVC(Model-View-Controller),M 是指业务模型,V 是指用户界面,C 则是控制器,使用 MVC 的目的是 ...
- angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testServe
angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testSer ...
- (翻译)Angular.js为什么如此火呢?
在本文中让我们来逐步发掘angular为什么如此火: Angular.js 是一个MV*(Model-View-Whatever,不管是MVC或者MVVM,统归MDV(model Drive View ...
- angular.js写法不规范导致错误
以下写法:没有明确指定module和controller,写法不规范. 更改angular.js版本会出bug. <html ng-app> <head> <title& ...
- Angular.js实现折叠按钮的经典指令.
var expanderModule=angular.module('expanderModule',[]) expanderModule.directive('expander',function( ...
- Angular.js通过bootstrap实现经典的表单提交
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel= ...
- python , angular js 学习记录【1】
1.日期格式化 Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 199 ...
- Angular JS 学习之路由
1.AngularJS路由允许我们通过不同的URL访问不同的内容:通过AngularJS可以实现多视图的单页WEB访问(SPA) 2.通常我们的URL形式为http://runoob.com/firs ...
- Angular JS 学习之Bootstrap
1.要使用Bootstrap框架,必须在<head>中加入链接: <link rel="stylesheet" href="//maxcdn.boots ...
随机推荐
- Linux的安装教程
CentOS 6 + VMWare: 资源:https://pan.baidu.com/s/1AA4gaMpaoVaMor-tRU-n7A 提取码:6e8r ( 内附 VMWare 14 激活 ...
- linux中的umask命令
转载:http://blog.51cto.com/1123697506/882064 一 权限掩码umask umask是chmod配套的,总共为4位(gid/uid,属主,组权,其它用户的权限),不 ...
- 基于vue的nuxt框架cnode社区服务端渲染
nuxt-cnode 基于vue的nuxt框架仿的cnode社区服务端渲染,主要是为了seo优化以及首屏加载速度 线上地址 http://nuxt-cnode.foreversnsd.cngithub ...
- 9.3.4 BeaufitulSoup4
BeautifulSoup 是一个非常优秀的Python扩展库,可以用来从HTML或XML文件中提取我们感兴趣的数据,并且允许指定使用不同的解析器. 使用 pip install BeaufifulS ...
- 3.2.1 for循环与while循环的基本语法
不停地重复一件事情,时间久了会非常无聊,然后大脑就会由于疲劳而容易入睡. 重复性的劳动会使人疲劳,而计算机不会,只要代码写得正确,计算机就会孜孜不倦地重复工作.在Python中主要有两种形式的循环结构 ...
- sql server的 between and 日期问题
- [luoguP1993] 小 K 的农场(差分约束 + spfa 判断负环)
传送门 差分约束系统..找负环用spfa就行 ——代码 #include <cstdio> #include <cstring> #include <iostream&g ...
- 文件描述符 VS 文件句柄
文件描述符 VS 文件句柄 文件描述符是标准 C 里用的,是 int 型的,比如调用 open 函数成功后会返回一个与当前文件相关联的 int 型数字. 文件句柄是 Windows 里用的,是 HAN ...
- Python3-paramiko-SFTP上传文件夹到多台远程服务器
# coding: utf-8 import paramiko import re import os from time import sleep # 定义一个类,表示一台远端linux主机 # 参 ...
- android 通用菜单条实现(一)
一.前言介绍 直奔主题啦,非常多Android app都有菜单条.菜单条除了背景图片.图标的不同外,布局基本一致.大致能够分为三部分:菜单条的左側区域.菜单条中间区域.菜单条右側区域. 为了考虑代码的 ...