feat: ngIf now supports else; saves condition to local var
NgIf syntax has been extended to support else clause to display template when the condition is false. In addition the condition value can now be stored in local variable, for later reuse. This is especially useful when used with the `async` pipe. Example: ``` <div *ngIf="userObservable | async; else loading; let user"> Hello {{user.last}}, {{user.first}}! </div> <template #loading>Waiting...</template> ``` closes #13061 closes #13297
This commit is contained in:

committed by
Victor Berchet

parent
e15a3f273f
commit
b4db73d0bf
4
tools/public_api_guard/common/index.d.ts
vendored
4
tools/public_api_guard/common/index.d.ts
vendored
@ -130,7 +130,9 @@ export declare class NgFor implements DoCheck, OnChanges {
|
||||
/** @stable */
|
||||
export declare class NgIf {
|
||||
ngIf: any;
|
||||
constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<Object>);
|
||||
ngIfElse: TemplateRef<NgIfContext>;
|
||||
ngIfThen: TemplateRef<NgIfContext>;
|
||||
constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>);
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
Reference in New Issue
Block a user