Skip to content
Related Articles

Related Articles

Improve Article

What is NgClass in Angular 10 ?

  • Last Updated : 30 Apr, 2021

In this article, we are going to see what is NgClass in Angular 10 and how to use it.

NgClass is used to Add or remove CSS classes on an HTML element


<element [ngClass] = "typescript_property">


  • Create the angular app to be used
  • In app.component.html make an element and sets its class using ngclass directive
  • serve the angular app using ng serve to see the output

Example 1:


import { Component, OnInit } from '@angular/core';
    selector: 'app-root',
    templateUrl: './app.component.html'
export class AppComponent {


<div [ngClass] ="'gfgclass'">


My Personal Notes arrow_drop_up
Recommended Articles
Page :