多条目练习
来源:互联网 发布:读单词软件 日语 编辑:程序博客网 时间:2024/06/15 06:22
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> li{ list-style: none;padding-top: 80px; } a{ text-decoration: none; color: black; } .header{ background: pink; width: 100%; height: 50px; text-align:center; line-height: 50px; color: white; font-size: 36px; } .ul{ width: 120px; float: left; } .ul li{ height: 30px; border: 1px solid black; line-height: 30px; text-align: center; } .content{ width: 70%;height: 500px; float: left; padding-left: 100px;padding-top: 50px; } </style> <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> <script src="https://apps.bdimg.com/libs/angular-route/1.3.13/angular-route.js"></script> <!-- <script src="angular1.4.6.min.js"></script> <script src="angular-ui-router.min.js"></script>--><!-- <script src="../angular/angular-1.5.5/angular.min.js"></script> <script src="../angular/angular-1.5.5/angular-route.js"></script>--> <script> var myapp=angular.module("myapp",["ngRoute"]); myapp.config(function ($routeProvider) { $routeProvider.when("/shouye",{ templateUrl:"pages/shouye.html", controller:"shouyeCtrl" }).when("/news",{ templateUrl:"pages/news.html", controller:"newsCtrl" }).when("/chaxun",{ templateUrl:"pages/chaxun.html", controller:"chaxunCtrl" }).when("/richeng",{ templateUrl:"pages/richeng.html", controller:"richengCtrl" }).when("/game",{ templateUrl:"pages/game.html", controller:"gameCtrl" }).otherwise({ redirectTo:"/news" }) }) myapp.controller("shouyeCtrl",function ($scope,$http) { $http({ url:"package.json" }).then(function (data) { $scope.data=data.data; }) }); myapp.controller("newsCtrl",function ($scope) { $scope.items=[ {bianhao:1234,name:"ipad",price:3400,kucun:10,check:false}, {bianhao:1244,name:"aphone",price:6400,kucun:100,check:false}, {bianhao:1334,name:"mypad",price:4400,kucun:20,check:false}, {bianhao:8234,name:"zpad",price:8400,kucun:130,check:false}, ] /*排序*/ $scope.orderName="bianhao"; $scope.order=false; $scope.paixu=function (column) { if($scope.orderName==column) { $scope.order=!$scope.order; }else{ $scope.order=false; } $scope.orderName=column; }; /* $scope.getClass=function (column) { if($scope.orderName==column) { if($scope.order==false) { return "top" }else{ return "bot" } } }*/ $scope.shanchu=function (index) {/*删除单个*/ if(confirm("确定删除吗?")) { $scope.items.splice(index,1); } } $scope.delall =function(){ alert("删除全部"); $scope.items.splice($scope.items); }; }); myapp.controller("chaxunCtrl",function ($scope,$http) { var u1="https://free-api.heweather.com/v5/weather?city="; var u2; var u3="&key=545d63e185fc48169a43cbabba6e74d2"; $scope.city="beijing"; $scope.show=false; $scope.search=function () { u2=$scope.city; $scope.show=true; $http({ url:u1+u2+u3 }).then(function (data) { $scope.cityName=data.data.HeWeather5[0].basic.city; $scope.date=data.data.HeWeather5[0].daily_forecast[0].date; $scope.temp=data.data.HeWeather5[0].daily_forecast[0].tmp.max; }); $scope.city=""; }; }) myapp.controller("richengCtrl",function ($scope) { var data={ user:"李四", items:[ {action:"约刘诗诗吃饭",done:false}, {action:"约刘诗诗跳舞",done:false}, {action:"约刘诗诗敲代码",done:true}, {action:"约刘诗诗爬长城",done:false}, {action:"约刘诗诗逛天坛",done:false}, {action:"约刘诗诗看电影",done:false}, ] }; $scope.data=data; $scope.complate=false; $scope.count=function () {/*判断还有几件事没完成*/ var n=0; for(var i=0;i<$scope.data.items.length;i++) { if($scope.data.items[i].done==false) { n++; } } return n; }; /*添加新的日程*/ $scope.add=function () { if($scope.action)/*对$scope.action进行下一个非空判断*/ { /*如果输入了内容*之后,就在数组的最后加入一条新内容*/ $scope.data.items.push({"action":$scope.action,"done":false}); $scope.action="";/*添加完成之后,将input置空*/ } } }) /*自定义过滤器*/ myapp.filter("doFilter",function () { return function (items,flag) { var arr=[]; for(var i=0;i<items.length;i++) { if(items[i].done==false) { arr.push(items[i]); }else{ if(flag==true) { arr.push(items[i]); } } } return arr; } }) </script></head><body ng-app="myapp"> <header class="header"> 标题 </header> <div class="nav"> <ul class="ul"> <li><a href="#shouye">首页</a></li> <li><a href="#news">新闻</a></li> <li><a href="#chaxun">查询</a></li> <li><a href="#richeng">日程</a></li> <li><a href="#game">游戏</a></li> </ul> <div ng-view="" class="content"></div> </div></body></html>
阅读全文
0 0
- 多条目练习
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目
- 多条目展示,banner和一些条目
- ListView多条目展示
- ListView多条目显示
- ListView多条目展示
- 多条目展示
- listview多条目展示
- 多条目布局
- 打开项目报[无法加载或初始化请求的服务提供程序]错误
- 负载均衡的基本算法
- 持续集成--使用dockerfile构建docker镜像
- 23种设计模式(14):解释器模式
- 运动相机检测无人机-- Detecting Flying Objects using a Single Moving Camera
- 多条目练习
- E40关闭硬件报警,即操作系统右下角的声音已经关了,但是有时候(如从睡眠恢复)也还是会有声音,很烦,怎么关闭
- java.lang.NoClassDefFoundError: javax/xml/rpc/Service
- iOS 之适配字体的几中方法
- xbanner无限轮播
- 生成正数的指定位数随机数
- Spring注解详解
- WRONGTYPE Operation against a key holding the wrong kind of value
- ICN(Information-Centric Networking)初步介绍