Features with a local variable

I am wondering what are the possibilities with a local variable. I know the following:

  • You can get the value

    <select #selectField (change)="funtionBla(selectField.value)" 
       <option value="1">1</option>
       <option value="2">2</option>
    </select>
    
  • You can call directive methods

     <button type="button" (click)="directiveBla.myFunction()"> test </button>
    

or HTML based

<video #movieplayer ...>
  <button (click)="movieplayer.play()">
</video>

But is there a way to change the style of the VIA Local Variable element, or can I add the element to the reference?

+4
source share
1 answer

You can get a link to elements with a local variable of type

@ViewChild('selectField') someField;

It is also used for DynamicComponentLoader.loadIntoLocation

dcl.loadIntoLocation(DynamicElement, _elementRef, 'selectedField')
+2
source

Source: https://habr.com/ru/post/1624972/


All Articles