入门未定义initvalue在构造

入门未定义initvalue在构造

问题描述:

我有我收到未定义initvalue入门未定义initvalue在构造

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

@Component({ 
    templateUrl: './medbot.component.html', 
}) 

export class Med { 
    initvalue: String 
    constructor() { 
     this.initvalue = "i have initialized this value" 
    } 


    processInput(message: string): void { 
     console.log(this.initvalue) 
    } 
} 

它是从medbot.component.html当我们对麦克风说话

一些所谓的angular2 在processInput方法的问题
<br><br> 
<div class="row" width="100%" style="margin:0"> 
    <microphone [audioInput]="processInput"></microphone> 
</div> 
+0

时,调用此方法? –

+0

它是否在改变什么,如果你定义'initvalue'为'string',而不是'String'?您也可以在每个语句的末尾添加一个分号。 – ConnorsFan

+0

当你调用processInput功能?你把它叫做OnInit吗? – izulito

我能发现出了什么毛病。我应该给audioInput像(audioInput)代替[audioInput]和processInput($事件)应该已经过去了。

<br><br> 
<div class="row" width="100%" style="margin:0"> 
    <microphone (audioInput)="processInput($event)"></microphone> 
</div>