我已经阅读了与Angular 2相关的各种问题跟踪器条目及其ng-repeat的实现,但是就目前而言,如果它实际存在,我实际上并未解决。
是否可以在角度2中使用ng-repeat?
Angular 2.0发布
我-component.ts:
- import { Component } from 'angular2/core';
- @Component({
- selector: 'my-component',templateUrl: './my-component.html'
- })
- export class MyComponent{
- public values: number[] = [1,2,3];
- }
我-component.html:
- <div *ngFor='let value of values; trackBy: index;'>
- {{ value }}
- </div>