5 lines
8.6 KiB
JSON

{
"id": "api/common/NgClass",
"title": "NgClass",
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/common\", \"name\": \"@angular/common\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/common/NgClass\", \"name\": \"NgClass\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/common\">@angular/common</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/src/directives/ng_class.ts?message=docs(common)%3A%20describe%20your%20change...#L11-L160\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/directives/ng_class.ts#L11-L160\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n <header class=\"api-header\">\n <h1 id=\"ngclass\">NgClass<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#ngclass\"><i class=\"material-icons\">link</i></a></h1>\n \n <label class=\"api-type-label directive\">directive</label>\n \n \n \n </header>\n \n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n \n <section class=\"short-description\">\n <p>Adds and removes CSS classes on an HTML element.</p>\n\n <p><a href=\"api/common/NgClass#description\">See more...</a></p>\n </section>\n \n \n \n \n\n <h2 id=\"ngmodule\">NgModule<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#ngmodule\"><i class=\"material-icons\">link</i></a></h2>\n<ul class=\"ngmodule-list\">\n\n <li>\n <a href=\"api/common/CommonModule\">\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box\">CommonModule</code-example>\n </a>\n </li>\n \n</ul>\n\n\n \n<section class=\"selector-list\">\n <h2 id=\"selectors\">Selectors<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#selectors\"><i class=\"material-icons\">link</i></a></h2>\n \n <ul>\n <li><code>[<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]</code></li>\n \n </ul>\n \n</section>\n\n\n\n \n\n<section class=\"instance-properties\">\n <h2 id=\"properties\">Properties<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#properties\"><i class=\"material-icons\">link</i></a></h2>\n <table class=\"is-full-width list-table property-table\">\n <thead>\n <tr>\n <th>Property</th>\n <th>Description</th>\n </tr>\n </thead>\n <tbody>\n \n <tr class=\"instance-property\">\n <td>\n <a id=\"klass\"></a>\n <code class=\"\"><span class=\"property-binding\">@<a href=\"api/core/Input\" class=\"code-anchor\">Input</a>('class')</span><br><span class=\"member-name\">klass</span>: string</code>\n </td>\n <td><span class=\"write-only-property\">Write-Only</span>\n \n \n \n </td>\n </tr>\n \n <tr class=\"instance-property\">\n <td>\n <a id=\"ngClass\"></a>\n <code class=\"\"><span class=\"property-binding\">@<a href=\"api/core/Input\" class=\"code-anchor\">Input</a>()</span><br><span class=\"member-name\"><a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a></span>: string | string[] | Set&#x3C;string> | { [klass: string]: any; }</code>\n </td>\n <td><span class=\"write-only-property\">Write-Only</span>\n \n \n \n </td>\n </tr>\n \n </tbody>\n </table>\n</section>\n\n\n\n \n\n\n \n <section class=\"description\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>The CSS classes are updated as follows, depending on the type of the expression evaluation:</p>\n<ul>\n<li><code>string</code> - the CSS classes listed in the string (space delimited) are added,</li>\n<li><code>Array</code> - the CSS classes declared as Array elements are added,</li>\n<li><code>Object</code> - keys are CSS classes that get added when the expression given in the value\nevaluates to a truthy value, otherwise they are removed.</li>\n</ul>\n\n <code-example>\n &#x3C;some-element [<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]=\"'first second'\">...&#x3C;/some-element>\n\n &#x3C;some-element [<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]=\"['first', 'second']\">...&#x3C;/some-element>\n\n &#x3C;some-element [<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]=\"{'first': true, 'second': true, 'third': false}\">...&#x3C;/some-element>\n\n &#x3C;some-element [<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]=\"stringExp|arrayExp|objExp\">...&#x3C;/some-element>\n\n &#x3C;some-element [<a href=\"api/common/NgClass\" class=\"code-anchor\">ngClass</a>]=\"{'class1 class2 class3' : true}\">...&#x3C;/some-element>\n</code-example>\n\n </section>\n \n\n \n\n \n\n \n\n<section class=\"instance-methods\">\n <h2 id=\"methods\">Methods<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#methods\"><i class=\"material-icons\">link</i></a></h2>\n \n <a id=\"ngDoCheck\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"ngdocheck\">\n ngDoCheck()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/NgClass#ngdocheck\"><i class=\"material-icons\">link</i></a></h3>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/src/directives/ng_class.ts?message=docs(common)%3A%20describe%20your%20change...#L78-L91\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/directives/ng_class.ts#L78-L91\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n \n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\">ngDoCheck</span>()</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n <p>There are no parameters.</p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n \n</section>\n\n \n \n \n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/common\n - api/common/CommonModule\n - api/core/DoCheck\n - guide/ajs-quick-reference\n - guide/binding-syntax\n - guide/browser-support\n - guide/built-in-directives\n - guide/ivy-compatibility-examples\n - guide/property-binding\n - guide/structural-directives\n - guide/upgrade\n-->\n<!-- links from this doc:\n - /api\n - api/common\n - api/common/CommonModule\n - api/common/NgClass#description\n - api/common/NgClass#methods\n - api/common/NgClass#ngclass\n - api/common/NgClass#ngdocheck\n - api/common/NgClass#ngmodule\n - api/common/NgClass#properties\n - api/common/NgClass#selectors\n - api/core/Input\n - https://github.com/angular/angular/edit/master/packages/common/src/directives/ng_class.ts?message=docs(common)%3A%20describe%20your%20change...#L11-L160\n - https://github.com/angular/angular/edit/master/packages/common/src/directives/ng_class.ts?message=docs(common)%3A%20describe%20your%20change...#L78-L91\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/directives/ng_class.ts#L11-L160\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/directives/ng_class.ts#L78-L91\n-->"
}