Input: Add condition if formControl to avoid undefined errors
This commit is contained in:
parent
c9c1aff2ff
commit
fd68a2cb10
|
@ -46,7 +46,7 @@ declare var UIkit;
|
||||||
@Component({
|
@Component({
|
||||||
selector: '[dashboard-input], [input]',
|
selector: '[dashboard-input], [input]',
|
||||||
template: `
|
template: `
|
||||||
<div [id]="id">
|
<div *ngIf="formControl" [id]="id">
|
||||||
<div class="input-wrapper" [class.disabled]="formControl.disabled" [class.opened]="opened"
|
<div class="input-wrapper" [class.disabled]="formControl.disabled" [class.opened]="opened"
|
||||||
[class.focused]="focused" [ngClass]="inputClass" [class.hint]="hint"
|
[class.focused]="focused" [ngClass]="inputClass" [class.hint]="hint"
|
||||||
[class.active]="(formAsControl?.value || type === 'select' || formAsArray?.length > 0 || getLabel(formAsControl?.value)) && !focused"
|
[class.active]="(formAsControl?.value || type === 'select' || formAsArray?.length > 0 || getLabel(formAsControl?.value)) && !focused"
|
||||||
|
@ -142,14 +142,14 @@ declare var UIkit;
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="formControl.invalid && formControl.touched" class="uk-text-danger">
|
<span *ngIf="formControl?.invalid && formControl?.touched" class="uk-text-danger">
|
||||||
<span *ngIf="formControl.errors.error">{{formControl.errors.error}}</span>
|
<span *ngIf="formControl.errors.error">{{formControl.errors.error}}</span>
|
||||||
<span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span>
|
<span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="uk-text-danger uk-text-small">
|
<span class="uk-text-danger uk-text-small">
|
||||||
<ng-content select="[error]"></ng-content>
|
<ng-content select="[error]"></ng-content>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="formControl.valid" class="uk-text-warning uk-text-small">
|
<span *ngIf="formControl?.valid" class="uk-text-warning uk-text-small">
|
||||||
<ng-content select="[warning]"></ng-content>
|
<ng-content select="[warning]"></ng-content>
|
||||||
<span *ngIf="!secure">
|
<span *ngIf="!secure">
|
||||||
<span class="uk-text-bold">Note:</span> Prefer urls like "<span class="uk-text-bold">https://</span>example.com/my-secure-image.png"
|
<span class="uk-text-bold">Note:</span> Prefer urls like "<span class="uk-text-bold">https://</span>example.com/my-secure-image.png"
|
||||||
|
|
Loading…
Reference in New Issue