搜狗截图20190916140417.png

app.component.ts

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'app-root',
  4. templateUrl: './app.component.html',
  5. styleUrls: ['./app.component.css']
  6. })
  7. export class AppComponent {
  8. title = 'pinduoduo';
  9. tabs = ['x', 'y']
  10. }

app.component.html

  1. <ul>
  2. <li *ngFor="let item of tabs"><a href="#">{{ item }}</a></li>
  3. </ul>

模板+样式+元数据= 组件