路由,删除,模糊查询,查询天气,全选,添加
2017-09-21 15:53
337 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ margin:0; padding:0; } li{ list-style: none; } .left{ float: left; } .left li{ border:1px solid black; height: 35px; width: 100px; line-height: 25px; text-align: center; color: black; } .inner{ padding-left: 50px; float: left; } .tb1{ margin-top: 10px; border-collapse: collapse; } .tb1 td{ width: 150px; height: 40px; line-height: 40px; border: 1px solid black; } .tb1 th{ width: 150px; height: 40px; line-height: 40px; border: 1px solid black; } header{ height:100%; height: 50px; line-height: 50px; text-align: center; background: pink; } </style> <script src="../test1/angular.min.js"></script> <script src="../test1/angular-route.js"></script> <script> var myapp=angular.module("myapp",["ngRoute"]); myapp.config(function ($routeProvider) { $routeProvider.when("/home",{ templateUrl:"pages/home.html", controller:"homeCtrl" }).when("/second",{ templateUrl:"pages/second.html", controller:"secondCtrl" }).when("/third",{ templateUrl:"pages/third.html", controller:"thirdCtrl" }) }) myapp.controller("homeCtrl",function ($scope) { $scope.date=[{ bianhao:"123",name:"iphone",price:3400,num:10 },{ bianhao:"321",name:"ipad",price:6400,num:100 },{ bianhao:"512",name:"plus",price:5900,num:1000 },{ bianhao:"2144",name:"sumsung",price:1000,num:1 }] $scope.delete=function (index) { var a = confirm("确定删除吗?"); if(a){ $scope.date.splice(index,1); } } $scope.ischeck=false; $scope.checkAll=function () { $scope.ischeck=!$scope.ischeck; } $scope.deleteall=function () { var a = confirm("确定全部删除吗?"); if(a){ $scope.date.splice(0,$scope.date.length); } } $scope.sort="name"; $scope.servece=false; $scope.sortFun=function (column) { if($scope.sort==column){ $scope.servece=!$scope.servece; } $scope.sort=column; } }) //查询天气 var u1="https://free-api.heweather.com/v5/weather?city="; var u2; var u3="&key=545d63e185fc48169a43cbabba6e74d2"; myapp.controller("secondCtrl",function ($scope,$http) { $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.weather=data.data.HeWeather5[0].daily_forecast[0].cond.txt_d; $scope.wendu=data.data.HeWeather5[0].daily_forecast[0].hum; }); $scope.city=""; } }) //向表格中添加数据 myapp.controller("thirdCtrl",function ($scope) { $scope.arr=[]; $scope.add=function () { $scope.arr.push({name:$scope.name,num:$scope.num,price:$scope.price,where:$scope.where}); $scope.name=""; $scope.num=""; $scope.price=""; $scope.where=""; } //删除数据 $scope.delete=function (index) { $scope.arr.splice(index,1); } }) </script> </head> <body ng-app="myapp"> <header>xxx管理系统</header> <ul class="left"> <li><a href="#home">首页</a></li> <li><a href="#second">第二</a></li> <li><a href="#third">第三</a></li> </ul> <div ng-view="" class="inner"></div> </body> </html>
相关文章推荐
- Mybatis框架的模糊查询(多种写法)、删除、添加(四)
- 路由添加、修改、批量&全部删除&全选反选
- AngularJS 查询、全选、反选、全部删除、批量删除、添加、修改
- 简单排序,单一删除,隔行换色,模糊查询,添加用户
- 【Mybatis从0到1-004】模糊查询、更新、删除、添加用户
- AngularJS综合用户信息, 表单验证,过滤查询,全选反选,批量删除,修改,添加
- 模糊查询+删除+修改+添加习题
- 商品订单(增删改查):新增订单;批量删除,发货;模糊查询,下拉菜单内容过滤(含时间);全选反选,列名排序
- 1. AngularJS+路由+JQuery:模糊查询过滤内容,下拉菜单排序,过滤敏感字符,验证判断后添加表格信息(路由显示添加页面)
- 添加订单删除 批量删除 模糊查询 过滤
- AngularJS 查询、添加、删除、全选、反选、点击排序
- 用户信息的增删改查:非空验证添加,模糊查询,修改密码,批量和全部删除
- 模糊查询全部删除添加用户
- html angular+route:模糊查询+限定年龄范围+全部删除+批量删除+修改密码+添加用户
- angular js 实现购物车模糊查询删除全选
- 稳扎稳打Silverlight(58) - 4.0通信之WCF RIA Services: 通过 Domain Service, 以 MVVM 模式实现数据的添加、删除、修改和查询
- 稳扎稳打Silverlight(58) - 4.0通信之WCF RIA Services: 通过 Domain Service, 以 MVVM 模式实现数据的添加、删除、修改和查询
- 封装Hibernate对数据库的操作,包括: 添加,删除,修改,加载,查询,分页查询,命名查询
- .数据库、表的建立,记录的添加、查询、修改和删除
- Angularjs实现购物车功能(按钮增减数量、添加、全选、删除、批量删除、结算)