input/src/input/input.component.ts
<input|textarea talenra-input> provides consistent styling and behaviour for form inputs and textareas.
It is typically used as child of <talenra-form-field>.
// Component class
sampleForm: FormGroup = new FormGroup({
lastName: new FormControl(''),
comment: new FormControl(''),
});<!-- Component template -->
<form [formGroup]="sampleForm">
<talenra-form-field label="Lastname">
<input talenra-input formControlName="lastName" type="text" />
</talenra-form-field>
<talenra-form-field label="Comment">
<textarea talenra-input formControlName="comment"></textarea>
</talenra-form-field>
</form>// Import `FormsModule` in the declaring module
import { FormsModule } from '@angular/forms';
@NgModule({
// ...
imports: [FormsModule],
})// Component class
lastName = '';
comment = '';<!-- Component template -->
<form #templateDrivenForm="ngForm">
<talenra-form-field label="Lastname">
<input talenra-input name="lastName" [(ngModel)]="lastName" type="text" />
</talenra-form-field>
<talenra-form-field label="Comment">
<textarea talenra-input name="comment" [(ngModel)]="comment"></textarea>
</talenra-form-field>
</form>// Component class
lastName = '';
comment = '';<!-- Component template -->
<talenra-form-field label="Lastname">
<input talenra-input [(ngModel)]="lastName" />
</talenra-form-field>
<talenra-form-field label="Comment">
<textarea talenra-input [(ngModel)]="comment"></textarea>
</talenra-form-field>import { InputComponent } from '@talenra/components/input';
OnInit
ControlValueAccessor
FormFieldControl
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| providers |
InputComponent
|
| selector | input[talenra-input], textarea[talenra-input] |
| styleUrls | ./input.component.scss |
Properties |
|
Methods |
|
Inputs |
Accessors |
| disabled |
Type : boolean
|
|
Determines whether the control is disabled/enabled. |
| type |
Type : TInputType
|
Default value : InputType.Text
|
|
The value provided to the input elements See InputComponent See MDN: Input type |
| Public focus |
focus()
|
|
Sets the focus to the input.
Returns :
void
|
| Public hasScroll |
Type : unknown
|
Default value : signal<boolean>(false)
|
|
Determines whether the input has vertical scroll offset (textarea only) |
| disabled | ||||||
getdisabled()
|
||||||
|
Determines whether the control is disabled/enabled.
Returns :
boolean
|
||||||
setdisabled(value: boolean)
|
||||||
|
Set the control's disabled state
Parameters :
Returns :
void
|