angular-template

Getting Object is possibly 'null'. in Angular template file

拟墨画扇 提交于 2021-01-27 07:40:44
问题 In my Angular app, I'm getting the following error: Object is possibly 'null'. The problem is that I'm getting this error not because of some typescript code, but because of this html template: <form [formGroup]="form"> <timepicker [formControlName]="'myControl'"></timepicker> </form> <br> <button class="btn btn-succes" (click)="form.get('myControl').enable()">Enable Control</button> <button class="btn btn-warning" (click)="form.get('myControl').disable()">Disable Control</button> <br><br>

How to enable mat tooltip if its host button is disabled in angular 9 template

假如想象 提交于 2020-06-29 03:57:18
问题 I have a button that I want to display a material tooltip for only when the button is disabled. This is the button : <button mat-icon-button #tooltip="matTooltip" matTooltip="Do X to create an account" [matTooltipDisabled]="...IDK" [disabled]="false" (click)="onAddAccountAction()" > <mat-icon>Add</mat-icon> </button> I don't know what flag/condition I should use in [matTooltipDisabled] so that the tooltip is not display when the [disabled] attribute for the same button is true. EDIT So I

How to enable mat tooltip if its host button is disabled in angular 9 template

孤街浪徒 提交于 2020-06-29 03:56:48
问题 I have a button that I want to display a material tooltip for only when the button is disabled. This is the button : <button mat-icon-button #tooltip="matTooltip" matTooltip="Do X to create an account" [matTooltipDisabled]="...IDK" [disabled]="false" (click)="onAddAccountAction()" > <mat-icon>Add</mat-icon> </button> I don't know what flag/condition I should use in [matTooltipDisabled] so that the tooltip is not display when the [disabled] attribute for the same button is true. EDIT So I

Combine two or more (boolean) observables on single ngIf using async pipe

半腔热情 提交于 2020-06-10 09:09:33
问题 Without observables I can write the following line in the HTML template: <div *ngIf="(myVarA || myVarB) && myVarC !== x"></div> How do I translate this line if all myVar variables are now actually observables? <div *ngIf="((myVarA | async) || (myVarB | async)) && (myVarC | async) !== x"> does not work. In another question (Putting two async subscriptions in one Angular *ngIf statement) the possibility to combine two or more observables into one ngIf can be achieved like <div *ngIf="{ a:

Combine two or more (boolean) observables on single ngIf using async pipe

淺唱寂寞╮ 提交于 2020-06-10 09:08:51
问题 Without observables I can write the following line in the HTML template: <div *ngIf="(myVarA || myVarB) && myVarC !== x"></div> How do I translate this line if all myVar variables are now actually observables? <div *ngIf="((myVarA | async) || (myVarB | async)) && (myVarC | async) !== x"> does not work. In another question (Putting two async subscriptions in one Angular *ngIf statement) the possibility to combine two or more observables into one ngIf can be achieved like <div *ngIf="{ a:

How to escape single curly braces angular 4 template

江枫思渺然 提交于 2020-03-18 14:53:50
问题 I have something like <div ngNonBindable> yada yada.... { ... } blah blah.... <div> Even with 'ngNonBindable' directive I get error: compiler.es5.js:1690 Uncaught Error: Template parse errors: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (" <div> Two things: 1) Please point me in right direction. 2) Or, a workaround please. 回答1: You can bind the text to a string literal: <div> {{"yada yada.... { ... } blah blah...."}} <div> (if the