Skip to content

Commit

Permalink
fix(common): allow null/undefined to be passed to ngClass input (angu…
Browse files Browse the repository at this point in the history
…lar#39280)

With strict template type checking, a null/undefined value will raise an
error. However the implementation is completely fine with it, and it
would be pointless to "fix" it at the callsite and convert to e.g. an
empty string. Allow all of the "supported types" to be passed in
directly to ngClass.

PR Close angular#39280
  • Loading branch information
imirkin committed Jul 20, 2022
1 parent 4e328c4 commit 96ed224
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common/src/directives/ng_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class NgClass implements DoCheck {
}

@Input('ngClass')
set ngClass(value: string|string[]|Set<string>|{[klass: string]: any}) {
set ngClass(value: string|NgClassSupportedTypes) {
this._removeClasses(this._rawClass);
this._applyClasses(this._initialClasses);

Expand Down

0 comments on commit 96ed224

Please sign in to comment.