sarpay
12/17/2019 - 4:17 PM

ng*

ngForm

<form #myForm="ngForm" (ngSubmit)="addPost(myForm)"> ... </form>
<form #myForm="ngForm" (ngSubmit)="addPost(); myForm.reset()"> ... </form>

<button type="button" (click)="myForm.resetForm({})">Reset Form</button>
<button type="button" (click)="myForm.reset({})">Reset Form</button>
addPost(form: NgForm){
  this.newPost = {
    title: this.title,
    body: this.body
  }
  this._postService.addPost(this.newPost);
  form.reset(); // or form.resetForm();
}

https://stackoverflow.com/questions/41500102/cleanest-way-to-reset-forms/43985754
https://itnext.io/to-reset-a-form-or-to-resetform-555d3da47c52

*ngIf

<span *ngIf="!advancedFiltersAreShown">test</span>

Inline *ngIf Container/Template

<div class="col-6 mb-3">
  <h6>{{l("Carrier")}} :</h6>
  <ng-container *ngIf="
    item.controlNumber.status !== 1 && item.lookupName;
        then showCarrier;
        else notApplicable">
  </ng-container>
  <ng-template #showCarrier>
    <span>{{item.lookupName}}</span>
  </ng-template>
  <ng-template #notApplicable>
    <span>N/A</span>
  </ng-template>
</div>