多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
##创建用户数据 1. 创建一个data数组来模拟保存从数据库中读取的数据 ~~~ $scope.data = [ { name:"张三", age:20, sex:"男" }, { name:"李四", age:18, sex:"女" }, { name:"王五", age:30, sex:"男" } ]; ~~~ 2. 把数据放到C:/demo/App/Modules/System/Controllers/User/UserSystemCtrl.js 文件控制器里 ![](https://box.kancloud.cn/5394c585e402992fb84c1c75cffc57b0_1366x768.gif) 3. 修改视图C:/demo/App/Modules/System/Views/User/UserView.html把数据遍历出来 ![](https://box.kancloud.cn/693d1739fe3ce9266bad9bdfea0f3cd6_1366x768.gif) &nbsp; ##用户管理 的demo代码 1.C:/demo/App/Modules/System/Controllers/User/UserSystemCtrl.js 控制器所有代码 ~~~ /** * 自动创建于:2017-03-24 13:02:07 */ (function () { "use strict"; angular.module("App").controller("UserSystemCtrl",["$rootScope","$scope",function ($rootScope,$scope) { $scope.data = [ { name:"张三", age:20, sex:"男" }, { name:"李四", age:18, sex:"女" }, { name:"王五", age:30, sex:"男" } ]; }]); })(); ~~~ 2.C:/demo/App/Modules/System/Views/User/UserView.html 视图所有代码 ~~~ <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> 用户管理 </h3> </div> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <table class="table table-hover"> <thead> <tr> <th> # </th> <th> 姓名 </th> <th> 年龄 </th> <th> 性别 </th> </tr> </thead> <tbody> <tr ng-repeat="o in data"> <td> {{$index+1}} </td> <td> {{o.name}} </td> <td> {{o.age}} </td> <td> {{o.sex}} </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> ~~~