多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
```html <!DOCTYPE html> <html lang="zh-CN" ng-app="myApp"> <head> <title>Simple app</title> <meta charset="UTF-8"> <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"> <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.css" rel="stylesheet"> <script src="http://cdn.bootcss.com/angular.js/1.5.0/angular.js"></script> <script src="http://cdn.bootcss.com/jquery/2.2.1/jquery.js"></script> </head> <body> <table class="table" ng-controller="MyCtrl"> <thead> <tr> <th>姓名</th> <th>性别</th> <th>国籍</th> <td>操作</td> </tr> </thead> <tbody> <tr ng-repeat="person in people"> <td>{{person.name}}</td> <td>{{person.sex}}</td> <td>{{person.city}}</td> <td> <a href="javascript:;" ng-click="delete(person)">删除</a> <a href="javascript:;" ng-click="edit(person)">编辑</a> </td> </tr> </tbody> <tfoot> <tr> <td> <input type="text" name="name" value="" ng-model="student.name" /> </td> <td> <label><input type="radio" name="sex" value="1" ng-model="student.sex" /> 男</label> <label><input type="radio" name="sex" value="2" ng-model="student.sex" /> 女</label> </td> <td> <select name="nation" ng-model="student.city" > <option value="太原" selected="selected">太原</option> <option value="运城">运城</option> </select> </td> <td> <button type="button" ng-click="add()">新增</button> <button type="button" ng-click="save()">保存</button> </td> </tr> <tr> <td colspan="4">{{ student | json }}</td> </tr> </tfoot> </table> <script type="text/javascript"> var app = angular.module('myApp', []) .controller('MyCtrl', function($scope){ $scope.student = {}; $scope.reset = function(){ $scope.student = { name : '', sex : 1, city : '' }; }; $scope.people = []; $scope.add = function(){ console.log($scope.student); $scope.people.push({ name : $scope.student.name, sex : $scope.student.sex, city : $scope.student.city }); $scope.reset(); }; $scope.delete = function(person){ var persons = []; for(var i=0; i<$scope.people.length; i++){ if(person != $scope.people[i]){ persons.push($scope.people[i]); }; }; $scope.people = persons; }; $scope.edit = function(person){ $scope.student = person; }; $scope.save = function(person){ $scope.reset(); }; }); </script> </body> </html> ```