“output sudut” Kode Jawaban

Kirim Acara ke Komponen Anak Angular

Parent-Component

eventsSubject: Subject<void> = new Subject<void>();

emitEventToChild() {
  this.eventsSubject.next();
}


Parent-HTML

<child [events]="eventsSubject.asObservable()"> </child>


Child-Component

private eventsSubscription: Subscription;

@Input() events: Observable<void>;

ngOnInit(){
  this.eventsSubscription = this.events.subscribe(() => doSomething());
}

ngOnDestroy() {
  this.eventsSubscription.unsubscribe();
}
Coding is simple XD

output sudut

content_copy
export class ItemOutputComponent {

  @Output() newItemEvent = new EventEmitter<string>();

  addNewItem(value: string) {
    this.newItemEvent.emit(value);
  }
}
simon caf

output arahan sudut

// just use it normal
@Output() itch:EventEmitter<any> = new EventEmitter();

//and call in html
<div appCollar (itch)='scratch()' >
GutoTrosla

@output () sudut

@Input() and @Output() give a child component a way to communicate 
with its parent component.

@Input() lets a parent component update data in the child component. 
@Output() lets the child send data to a parent component.

// Please click source link for more details
Tiny Coders

Jawaban yang mirip dengan “output sudut”

Pertanyaan yang mirip dengan “output sudut”

Lebih banyak jawaban terkait untuk “output sudut” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya