Ivy - Map values are not working with ngClass expressions
See original GitHub issueWith Angular Ivy(version: 9.0.0-rc.5) Map values are not working with ngClass expressions. This is working without Ivy.
- Minimal steps to reproduce
@Component({
selector: 'app-root',
template: `
<button [ngClass]="clsMap">Hello World</button>
`,
styles: [
`
.btn {
min-width: 100px;
padding: 10px;
}
.btn.btn-primary {
background-color: teal;
}
`
]
})
export class AppComponent {
title = 'ng-cls-map-issue';
clsMap = new Map([
['btn', true],
['btn-primary', true]
])
}
Output with Ivy:

Output without Ivy:

Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Angular NgClass Example – How to Add Conditional CSS ...
Just a heads up – the value of ngClass doesn't have to be a literal, as shown above. Keep in mind that property...
Read more >ngClass string binding expression with class map
I want to conditionally add a class based on the existence of a variable as well as use that variable in the expression...
Read more >Type-checking templates in Angular View Engine and Ivy
In this article we'll explore how Angular type-checks templates, review the difference between View Engine and Ivy type-checking and break down the process ......
Read more >Using predictable style bindings | Accelerating Angular ...
Angular has many ways to bind styles and classes to Document Object Model (DOM) elements. Ivy introduces predictable style bindings because of a...
Read more >Property binding [property] - Angular
If getFoo() changes something and you happen to be binding to that something, Angular may or may not display the changed value. Angular...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@matsko I think we can close this issue
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.