Get user input from textarea

后端 未结 6 1182
失恋的感觉
失恋的感觉 2020-12-24 10:48

I\'m new to angular2. I want to store user input from a text area in a variable in my component so I can apply some logic to this input. I tried ngModel but it

6条回答
  •  半阙折子戏
    2020-12-24 11:05

    I think you should not use spaces between the [(ngModel)] the = and the str. Then you should use a button or something like this with a click function and in this function you can use the values of your inputfields.

    
    
    

    and in your component file

    str: string;
    sendValues(): void {
    //do sth with the str e.g. console.log(this.str);
    }
    

    Hope I can help you.

提交回复
热议问题