*ngIf

*ngIf=” “

  1. # app.component.html
  2. <div *ngFor="let item of list">
  3. <div *ngIf="item>3">
  4. {{item}}
  5. </div>
  6. </div>
  1. # app.component.ts
  2. import { Component } from '@angular/core';
  3. @Component({
  4. //根主键
  5. selector: 'app-root',
  6. templateUrl: './app.component.html',
  7. styleUrls: ['./app.component.css']
  8. })
  9. export class AppComponent {
  10. title = 'my-app';
  11. list:Array<number> = [1,2,3,4,5,6];
  12. handleClick():void{
  13. console.log(this.title);
  14. this.title = 'change'
  15. }
  16. }