#Getting data to re-render a page

6 messages · Page 1 of 1 (latest)

analog otter
#

first of all, don't use this in templates. It's unnecessary

chilly moat
#

Ok, noted. didn't know that tbf

chilly moat
analog otter
#
  • Do you use onPush?
  • Where/how do you set userRoles and claim?
#

It's quite possible you get data from the server and it never detects changes

chilly moat
# analog otter - Do you use onPush? - Where/how do you set `userRoles` and `claim`?

I do not use onPush. I use the default strategy

The claim is got by a base class

    private getAllInOneClaim(): void {
        this.service.GetOneClaim(this.claim).pipe(first()).subscribe(res => {
            this.common.ConsoleLog('getAllInOneClaim', res);
            this.claim= res;
            this.claimLoaded.emit(this.claim.OperatorID);
            this.OnClaimLoaded();
            this.getPeriodClaims();
        });
    }

the user roles are got from a service

getUserPermissions() {
    if (!this._user) {
      this.accountService.fetchOperatorPermissions(this.localStorageID).subscribe(
        res => {
          this._user = res;
          this.userPermsUpdated.emit(res);
        }
      )
    } else {
      this.userPermsUpdated.emit(this._user);
    }
  }