Child 组件的@Output 不会触发 Angular 中的 EventEmitter 5

@Output from Child component doesn't trigger EventEmitter in Angular 5

我正在尝试将@Output 与事件发射器一起使用,以便在 child 和 parent 组件之间进行通信以传递变量。我遵循了本教程:https://dzone.com/articles/understanding-output-and-eventemitter-in-angular

我查看了与此相关的不同 Whosebug 问题,但 none 适用于我的情况。

Child HTML

<button (click)="onLinkedClicked();">Click me</button>

Child TS

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
.
.
.
export class showcaseMenuComponent implements OnInit {
    @Output() public linkedClicked = new EventEmitter<String>();

    constructor() {}

    onLinkedClicked() {
        console.log('on click child');
        this.linkedClicked.emit('collapsed');
    }
}

它打印日志 'on click child'

Parent HTML

 <showcase-menu #topNavMenu [showBranding]="false"
     [showSearch]= "false" (onLinkedClicked)="linkToggler($event)"></showcase-menu>

Parent TS

.
.
.
 navMenuState: string;
.
.
.
  linkToggler($event) {
    console.log("partent");
    this.navMenuState = $event;
  }

永远不会调用 linkToggler()。而且我在控制台中没有任何错误,

事件必须匹配与输出装饰器

关联的属性的名称
<showcase-menu #topNavMenu 
               [showBranding]="false"
               [showSearch]= "false"  
               (linkedClicked)="linkToggler($event)">. 
</showcase-menu>