What is wrong with my Angular code? I am getting the following error: Cannot read property ‘remove’ of undefined at BrowserDomAdapter.removeClass Answer Angular version 2+ provides several ways to add classes conditionally: type one type two and multiple option: type three type four You can find these examples on the documentation page