It’s conceptually the same as Angular 1’s ng-repeat, but you’ll find the syntax quite different as it aligns with #refs in Angular 2 and JavaScript “for of” loop.

import {Component, View, NgFor} from 'angular2/angular2';
import {TodoService} from './todoService';@Component({selector: 'todo-list'
})
@View({directives: [NgFor],template: `<div><div *ng-for="#todo of todoService.todos">{{todo}}</div></div>
    `
})export class TodoList{constructor(public todoService:TodoService){}
}

[Angular 2] ngFor相关推荐

  1. angular学习-*ngFor,*ngIf,*ngSwitch

    *ngFor,*ngIf,*ngSwitch学习记录 1.*ngFor 2.*ngIf 3.*ngSwitch 1.*ngFor 一般用于数据循环,例子(打印arr里边的值)如下: ts: html: ...

  2. Angular中ngfor与ngif的嵌套使用

    ng2 结构指令不能直接嵌套使用,可以通过使用标签来包裹指令,两个结构指令分开放在两个标签中,解决冲突. <ul *ngFor="let value of item; let key ...

  3. angular react_Angular 2 vs React:将会有鲜血

    angular react Angular 2 has reached Beta and appears poised to become the hot new framework of 2016. ...

  4. * ngIf和* ngFor在同一元素上导致错误

    本文翻译自:*ngIf and *ngFor on same element causing error I'm having a problem with trying to use Angular ...

  5. angular面试题及答案_关于最流行的Angular问题的StackOverflow上的48个答案

    angular面试题及答案 by Shlomi Levi 通过Shlomi Levi 关于最流行的Angular问题的StackOverflow上的48个答案 (48 answers on Stack ...

  6. Angular 4官方文档(二)【数据的展现】

    通过把 Angular 组件的属性绑定到 HTML 模板的控件上,我们可以展示数据. 本小节中,我们将会创建一个英雄列表组件.我们将展示英雄名字的列表,并根据条件来决定是否在列表下方展示一条信息. 最 ...

  7. 一步一步学习Angular2(03.示例 MASTER/DETAIL)

    接着上一篇文章,今天跟随官网上的例子学习怎样增加一个英雄列表,并为它增加漂亮的样式. 启动我们的应用 打工上一章的工程文件夹angular2-tour-of-heroes执行 npm start 英雄 ...

  8. Angular中数据循环ngFor、条件判断ngIf、ngSwitch、执行事件(click)、表单事件(keyup)、ngClass、ngStyle的使用

    场景 Angular介绍.安装Angular Cli.创建Angular项目入门教程: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/detail ...

  9. Angular *NgFor - angular 基础教程

    转载自 http://www.ngui.cc/news/show-115.html 在 Angular 中我们可以使用 ngFor 指令来显示数组中每一项的信息. 使用 ngFor 指令 更新 Mai ...

  10. Angular数据循环 *ngFor 与 条件判断 *ngif 和 *ngSwitch

    Angular数据循环 *ngFor 与 条件判断 *ngif 和 *ngSwitch 首先,进行Angular环境的搭建和项目创建 ctrl + c 结束服务 1.新建模块 ng g compone ...

最新文章

  1. python中tolist_python - 无法使用Gremlinpython使用“ .toList()”列出Janusgraph中存在的所有顶点 - 堆栈内存溢出...
  2. 嵌入式系统功能需求分析_超市监控系统的功能作用分析
  3. C语言入门经典题目及其答案
  4. python用递归法写斐波那契_python实现斐波那契数列: 递归+备忘录法+动态规划实现...
  5. angular 动画_如何在Angular 6中使用动画
  6. Hungary(匈牙利算法)——二分图最大匹配
  7. 行为设计模式 - 观察者设计模式
  8. 如何设置VSCode以提高生产力
  9. 堆排序(php实现)
  10. B-数,B+树,B*树简单定义
  11. RS232 DB9串口设备
  12. LiveReload拓展配合Webpack实现网页自动刷新
  13. 使用阿里云Maven仓库
  14. 【每日一题】一起冲击蓝桥杯吧——Day2【蓝桥真题】
  15. 【discuzX2】模板解析语法就template()函数分析
  16. Office VBA也能任性截图(屏幕任意区域截图)
  17. 搜索大全——实用搜索引擎
  18. java反序列化多个对象_java 序列化与反序列化多个对象 抛出异常
  19. 华为荣耀10青春版2G电话打不出去信号不稳定红警快修教你搞定
  20. 力扣刷题SQL篇(四)

热门文章

  1. 计算机管理固件在哪里,itunes固件位置在哪里
  2. 帆软 JS给填报控件(单元格)赋值 包含扩展单元格赋值
  3. freebsd mysql utf8_FreeBSD环境下Mysql问题解决方法集锦
  4. python整型图_基于PIL的图像整形与裁剪矢量化
  5. python做词典_字典实现
  6. linux系统关闭指定服务的方式
  7. IOS 中description 和 debugDescription的区别
  8. WIN7专业版下安装MS SQL SERVER 2005 开发版
  9. SQL Server 字段类型Char Varchar 比较
  10. 【TDA4系列】向 PSDKRA 添加新的图像传感器