I want to understand the difference between the designation of the reference variable variable, as indicated below in the input text fields.
<input type="text" name='name' #name [(ngModel)]='model'> <input type="text" name='name' ref-name [(ngModel)]='model'>
What is the difference between using #name and ref-name .Does the scope change when using the name ref? Can anyone suggest best practice and reason?
These are two different syntaxes for literally the same thing.
: ( ) "#variable", Angular , "" .
- , DOM. , . .
<input type="text" name='name' #name [(ngModel)]='model'>
#name . #... ref-. # ref- * ngFor. URL: http://www.concretepage.com/angular-2/angular-2-template-reference-variable-example
Template reference variable is a variable using which we can access DOM properties.
, DOM. # ref- , , #item ref-item.
#item
ref-item
<input type="text" #name placeholder="Enter your name" />
#name , DOM,
#name
name.placeholder " ", .
name.placeholder
name.value "" .
name.value
name.type "" .
name.type
, .
HTML-
ref-name.
ref-name
Source: https://habr.com/ru/post/1675545/More articles:Контекст Dafny изменяет ошибку предложения - dafnyTake "a" and "b" as equal if they are the same in their first 4 decimal places in R - functionExit crowded pages on macos sierra - pythonUnsubscribe from Angular2 method when providing specific answer? - angularNotepad ++ double click select word include other non-word characters - highlightTypescript / Javascript: using a tuple as a map key - javascriptGoogle Drive V3 Resume Download - vb.netоткрыть файл .sql в текстовом редакторе jupyter - jupyterIonic 2 native find contact plugin not coming out - angularjsDT package does not work with blogging using hugo-future-imperfect theme - rAll Articles