import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'app-order',
  templateUrl: './order.component.html',
  styleUrls: ['./order.component.css']
})
export class OrderComponent implements OnInit {

  @Input()
  orderName: string;

  @Input()
  count: number;

  constructor() { }

  ngOnInit() {
    setInterval(() => {
      this.orderName = 'bbb';
    }, 3000);
  }

}
<p>
  买{{count}}手{{orderName}}产品
</p>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  orderName: string;


  count: number;
}
<input [(ngModel)]='count'>
<input [(ngModel)]='orderName'>
<app-order [count]='count' [orderName]='orderName'></app-order>

 

相关文章:

  • 2022-12-23
  • 2021-11-11
  • 2021-06-04
  • 2021-12-17
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-11-17
  • 2021-11-02
  • 2022-02-02
相关资源
相似解决方案