I want the option of adding a class to an element. Initially I tried doing class="{{content.options.classes}}"
. This works if an "options", and a "classes" exist within a "content". However, not every content will have options and classes, which results in an error. So I wanted to create a conditional statement to add the class depending on whether or not it exists/is declared in an external object called "content".
I tried [ngClass]="{'{{content.options.classes}}' : true}"
, but am getting an interpolation error. What would be a better way to write or go about doing this?
how about class="{{content?.options?.classes}}"