I have a text box for entering some text. When the user finishes typing, I allow them to use [Enter] to confirm the text
<textarea #msgInput (keyup.enter)="confirmText(msgInput.value)" >
</textarea>
Although I can successfully get the text inside confirmText (). A new line is created for the value of the text field.
How to dump a new char string into a text box correctly? I know there is some method like return 0 and preventDefault () when writing js, but I don't know how to do this in Angular2 typescript.
source
share