Imad
Imad

Reputation: 7490

Calling component function from template

In template

<tr *ngFor='let activity of pagedWorkflowActivities' [style.background-color]="setBackgroundColor(activity)">

In component

setBackgroundColor(activity: WorkflowActivity) {
    return 'red';
}

I wrote this code in the component in which all other events that are related to same template is written. So I think it is the right place. I just can't get it worked as I am getting this error in developer tool.

self.parent.context.setBackgroundColor is not a function

Upvotes: 2

Views: 896

Answers (1)

Imad
Imad

Reputation: 7490

This is ridiculous, I was trying too many things to make it work but you know what solved it? I just reset IIS (as I am using Asp.Net) and rebuild the solution and it worked. I was getting same problem few days ago and I gave it up but the next day this issue was gone automatically. Might be caching issue but frustrating one.

Edit You can also try ipconfig /flushdns command that prevents rebuilding solution unnecessarily.

Edit I tried IE, Chrome, FF to test and I found FF reflects changes faster than others.

Upvotes: 2

Related Questions