Generate List and Table via ng-repeat
2024-08-25 05:54:39
<div ng-app ng-controller='StudentListController'>
<ul>
<li ng-repeat='student in students'>
<a href='/student/view/{{student.id}}'>{{student.name}}</a>
</li>
</ul>
<button ng-click="insertTom()">Insert</button> <br /> <table class="table-bordered" ng-controller='AlbumController'>
<tr ng-repeat='track in album'>
<td>{{$index + 1}}</td>
<td>{{track.name}}</td>
<td>{{track.duration}}</td>
</tr>
</table>
</div> <script src="~/Scripts/angular.js"></script>
<script>
var students = [{ name: 'Mary Contrary', id: '1' },
{ name: 'Jack Sprat', id: '2' },
{ name: 'Jill Hill', id: '3' }];
function StudentListController($scope) {
$scope.students = students;
$scope.insertTom = function () {
$scope.students.splice(1, 0, { name: 'Tom Thumb', id: '4' });
};
} var album = [{ name: 'Southwest Serenade', duration: '2:34' },
{ name: 'Northern Light Waltz', duration: '3:21' },
{ name: 'Eastern Tango', duration: '17:45' }];
function AlbumController($scope) {
$scope.album = album;
}
</script>
最新文章
- 一道关于java序列化的问题,看大家知多少————
- ORA-01012: not logged on
- mac os 下搭建android开发环境
- mysql binlog日志查看及解码
- webapi 中使用 protobuf
- 注解学习(模仿springMvc的注解注入方式)
- Struts2标签实现for循环
- nginx限制ip请求次数 以及并发次数
- CSDN首页>; 移动开发 直接拿来用!最火的Android开源项目(完结篇)
- 国内国外最好的java开发论坛及站点 [转]
- MSSQL - SqlDataAdapter连接数据库提高性能用法
- ASP.NET Core中的OWASP Top 10 十大风险-SQL注入
- eclipse导入包之后中文乱码
- WP-player——WordPress的一款好用的音乐插件
- SpringBoot 同时整合thymeleaf html、vue html和jsp
- Can&#39;t connect to X11 window server using &#39;:1.0&#39; as the value of the DISPLAY variable.
- Vmware10中Centos7挂载Windows主机的共享文件夹,提示:Error: cannot mount filesystem: No such device
- 可视化n次贝塞尔曲线及过程动画演示--大宝剑
- 每天学点SpringCloud(十):SpringCloud监控
- solr7.3.1在CentOS7上的安装
热门文章
- 【原】linux系统运维工具必备
- ee
- jsp页面List迭代
- JavaScript对象的创建之基于原型方式
- 解决Git报错:The current branch is not configured for pull No value for key branch.master.merge found in configuration
- opencv基于HSV的肤色分割
- Ogre参考手册(五)3.2 合成器
- Azure磁盘的吞吐量测试
- 洛谷P1467 循环数 Runaround Numbers
- 洛谷P1198 [JSOI2008]最大数