question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ivy - Map values are not working with ngClass expressions

See original GitHub issue

With 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: image

Output without Ivy: image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ajitsinghkalercommented, Jan 5, 2020

@matsko I think we can close this issue

0reactions
angular-automatic-lock-bot[bot]commented, Feb 27, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found