angular add id to html div only if conditions match 2 code example Example: angular add html attribute on condition <input [attr.attribute] = "condition ? '' : null" />