How to replicate jQuery actions in Angular 5

0

I have a form in html ( Angular ) and according to an event I must execute a function that recovers the value of one input and prints it in another, I did it in jQuery without problems in this way:

$('#selector').on('change', function(){
    var valor_obtenido = $('#selector option:selected').val();
    $('#input_tipo_texto').val(valor_obtenido);
});

Now what I need is instead of using jQuery, I should do the same but with Angular 5 , how could I do this?

Here I have the HTML:

<label for="selector">Selector:</label>
<select name="selector" id="selector" #selector="ngModel" [(ngModel)]="formulario.selector" class="form-control" required>
    <option *ngFor="let formularios of formulario" value="{{formularios.selector}}">{{formularios.nombre}}</option>
</select>

Thanks for the reply, greetings!

    
asked by user3123766 20.06.2018 в 02:09
source

1 answer

0

I already solved it

onChange(deviceValue) {
  console.log(deviceValue);
  this.formulario.input_tipo_texto= deviceValue;
}

And in the selector:

(change)="onChange($event.target.value)"
    
answered by 20.06.2018 в 02:22