[Angular 2] ngFor
2023-09-14 09:00:54 时间
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组件的基本使用
- 关于 Angular 里 module 和 Component 包含粒度的一个讨论
- Angular tsconfig.json 文件里的 paths 用途
- Angular 结合 dygraphs 实现 annotation
- Angular HTTP 请求自定义 timeout 值的一种实现思路
- Angular HTTPClient 发送请求的触发方式讨论
- Angular 面试题汇总2-Component/Service (Angular v8+)
- 关于 Angular 部署以及 index.html 里 base hRef 属性的关联关系
- orbital angular momentum_omnidirectional
- Angular 应用里 index.html 的作用
- 关于 Angular 应用的入口
- Angular 应用开发里使用 ForRoot 解决 Lazy Loaded Module 里单例行为丢失的问题
- 关于 Angular 工程文件 angular.json 里的 inlineCritical 属性
- 备受 Vue、Angular 和 React 青睐的 Signals 演进史
- angular.foreach循环方法使用指南
- Angular用来控制元素的展示与否的原生指令介绍
- angular中使用路由和$location切换视图