1

I am getting the error on the below html template:

<p *ngIf="startDate()"><span [innerHTML]="startDate()"></span> to 
        <span [innerHTML]="endDate()"></span></p>

Below is my startDate fn

startDate = () => {
  if (this.session.history[0]) {
      return this.session.history[0].date;
   } else {
      return "";
  }
};

I looked into some threads, but not able to understand the problem or solution. Angular2 - Expression has changed after it was checked - Binding to div width with resize events

Ths solution says we need to use ngAfterViewInit() here, but i am not really getting it.

Community
  • 1
  • 1
Shane
  • 5,517
  • 15
  • 49
  • 79
  • what is `this.session.history`? Looks like some function sets up `this.session.history[0].date` to some other value during the template rendering – smnbbrv Feb 06 '17 at 15:26
  • @smnbbrv: this is a value which i get from API, but that happens before the component is rendered... – Shane Feb 06 '17 at 15:32
  • 2
    Without the whole component code and, I'm afraid, the whole app there is no chance somebody can help you. Ideally you should create a plunkr – smnbbrv Feb 06 '17 at 17:41

0 Answers0