1
    I'm having issues with errors regarding `@Output` and `@EventEmitter` in Angular7.


        <button (click)="updateStatus()" class="btn btn-primary" >Valider</button>

    Code handling the click-event in the component:  
    import { Component, OnInit, Input, Output, EventEmitter, OnChanges  } from '@angular/core';

 @Input()
      set selectedCommande(value: Command) {
        this._selectedCommande = value;
      }
      get selectedCommande(): Command {
        return this._selectedCommande;
      }

//第一次捕获值,但失败后
@Output() putSelectedCommand = new EventEmitter();

        updateStatus() {
             this.putSelectedCommand.emit(this._selectedCommande);
        }

    Error: 
    >TypeError: this.putSelectedCommand.emit is not a function
4

0 回答 0