<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
<script>
angular.module("cg",[]).controller("tr",function($scope,$http){
$http.get("http://result.eolinker.com/lKgJQ8Zec38423e5603b8e055d1193a8127c0c060bb1b55?uri=test1")
.success(function(ol){
$scope.datas=ol;
<!--2-->
//新增
$scope.bc=function(){
if($scope.name==""||$scope.name==null){
$scope.u=true;
}
if($scope.type==""||$scope.type==null){
$scope.i=true;
}
else{
$scope.u=false;
$scope.i=false;
//时间
$scope.regdate=new Date();
$scope.datas.push({name:$scope.name,type:$scope.type,});
$scope.aa=false;
}
}
})
})
</script>
</head>
<body ng-app="cg" ng-controller="tr">
<!--2222222222-->
<button ng-click="aa=true" value="新增用户">新增用户</button>
<table border="1">
<!-- xinzeng-->
<tr>
<td>导演</td>
<td>电影售票</td>
<td>电影播放时长</td>
<td>电影类型</td>
<td>电影上映时间</td>
<td>电影评分</td>
</tr>
<tr ng-repeat="x in datas "> <!--mohu-->
<td><input type="hidden" ng-model="x.id"/>
</td>
<td>
<span ng-hide="f">{{x.name}}</span>
<input ng-show="f" ng-model="x.name" ng-blur="f=false"/></td>{{errors.id}}
<td >
<span ng-hide="f">{{x.type}}</span>
<input ng-show="f" ng-model="x.type" ng-blur="f=false"/></td>
<td> {{x.time}}</td>
<td> {{x.author}}</td>
<td> {{x.price}}</td>
</tr>
</table>
<!--111111111111111-->
<form ng-show="aa">
<input ng-model="name" /><span ng-show="u">:商品名不能为空</span><br>
<input ng-model="type" /><span ng-show="i">:用户名不能为空</span><br>
<input type="button" value="保存" ng-click="bc()" />
</form>
</body>
//二级联动
<script src="../js/jquery-3.2.1.min.js"></script>
<script>
function ll(){
var citys=[{sheng:"北京",shi:["海淀","昌平","通州"]},{sheng:"河北",shi:["石家庄","承德","邯郸"]}];
var ids=$("#ch").val();
var k=[];
for (var i=0;i<citys.length;i++) {
if(ids==citys[i].sheng){
k=citys[i].shi;
}
}
$("#chi option").remove();
for(var i=0;i<k.length;i++){
var op=$("<option>"+k[i]+"</option>");
$("#chi").append(op);
}
}
</script>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
<script>
angular.module("cg",[]).controller("tr",function($scope,$http){
$http.get("http://result.eolinker.com/lKgJQ8Zec38423e5603b8e055d1193a8127c0c060bb1b55?uri=test1")
.success(function(ol){
$scope.datas=ol;
<!--2-->
//新增
$scope.bc=function(){
if($scope.name==""||$scope.name==null){
$scope.u=true;
}
if($scope.type==""||$scope.type==null){
$scope.i=true;
}
else{
$scope.u=false;
$scope.i=false;
//时间
$scope.regdate=new Date();
$scope.datas.push({name:$scope.name,type:$scope.type,});
$scope.aa=false;
}
}
})
})
</script>
</head>
<body ng-app="cg" ng-controller="tr">
<!--2222222222-->
<button ng-click="aa=true" value="新增用户">新增用户</button>
<table border="1">
<!-- xinzeng-->
<tr>
<td>导演</td>
<td>电影售票</td>
<td>电影播放时长</td>
<td>电影类型</td>
<td>电影上映时间</td>
<td>电影评分</td>
</tr>
<tr ng-repeat="x in datas "> <!--mohu-->
<td><input type="hidden" ng-model="x.id"/>
</td>
<td>
<span ng-hide="f">{{x.name}}</span>
<input ng-show="f" ng-model="x.name" ng-blur="f=false"/></td>{{errors.id}}
<td >
<span ng-hide="f">{{x.type}}</span>
<input ng-show="f" ng-model="x.type" ng-blur="f=false"/></td>
<td> {{x.time}}</td>
<td> {{x.author}}</td>
<td> {{x.price}}</td>
</tr>
</table>
<!--111111111111111-->
<form ng-show="aa">
<input ng-model="name" /><span ng-show="u">:商品名不能为空</span><br>
<input ng-model="type" /><span ng-show="i">:用户名不能为空</span><br>
<input type="button" value="保存" ng-click="bc()" />
</form>
</body>
//二级联动
<script src="../js/jquery-3.2.1.min.js"></script>
<script>
function ll(){
var citys=[{sheng:"北京",shi:["海淀","昌平","通州"]},{sheng:"河北",shi:["石家庄","承德","邯郸"]}];
var ids=$("#ch").val();
var k=[];
for (var i=0;i<citys.length;i++) {
if(ids==citys[i].sheng){
k=citys[i].shi;
}
}
$("#chi option").remove();
for(var i=0;i<k.length;i++){
var op=$("<option>"+k[i]+"</option>");
$("#chi").append(op);
}
}
</script>
</html>