Skip to content
Advertisement

Angular 2 Material Input change placeholder dynamically

I want to change the text of the input placeholder dynamically. The console.log already gives the updated string but the interface doesn’t update so there stays the old placeholder. How can I get the Interface to recognize the change?

JavaScript

Advertisement

Answer

you can change your input placeholder dynamically like this

JavaScript

component.ts

JavaScript

now you can change somePlaceholder value any where in the class.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement