0

I want to put a value inside an input.

this is what I did:

<input [value]="example" [(ngModel)]="phaseToUpdate.phaseName" type='text' >

and usually it's working but I think it is not working right now because this input is inside a modal.

any suggestions what do to ?

Bar Levin
  • 205
  • 1
  • 12

2 Answers2

1

Just bind using the two way data binding

<input type="text" id="example" [(ngModel)]="example">
    <span class="e">{{example}}</span>
Ram
  • 356
  • 2
  • 14
  • well i'm using the ngModel for catching the value the user enters the input so my input basiclly looks like that: – Bar Levin Aug 28 '19 at 06:31
  • i think you need to go through this link, https://stackoverflow.com/questions/42699705/ngmodel-vs-value – Ram Aug 28 '19 at 06:43
  • you cant have both value and ngmodel on the same element, if you have, ngmodel would overwrite that – Ram Aug 28 '19 at 06:44
0

You can use like below, it will

<input matInput [(ngModel)]="name" placeholder="What's your name?">
pk_teckie
  • 147
  • 3
  • 17