PARAMANANDA PRADHAN
PARAMANANDA PRADHAN

Reputation: 1169

Angular2: How to use css calc() with some component value?

I want to calculate div height based on the component value by using calc CSS function. The error it gave me:

TypeError: co.calc is not a function

My code:

<div [ngStyle]="{'height': calc(100% - + assetScreenSize + px)}">
</div>

Upvotes: 11

Views: 7072

Answers (1)

Aslam
Aslam

Reputation: 9662

Your syntax is incorrect. The correct way would be:

<div [ngStyle]="{'height': 'calc(100% -' + assetScreenSize + 'px)'}">
</div>

Upvotes: 10

Related Questions