Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
Angular Material badge content not getting updated from its sibling directive

I have parent component ParentComponent. Inside in this components template I have span element with MatBadge directive and my custom directive dir1

<span matBadge dir1 matBadgeColor="warn"></span>

I am trying to control Mat Badge content over my custom directive Dir1. My custom directive is connected to service

According to original documentation of AngularMaterial API, MatBadge directive has @Input (item | property) called content

As My Dir1 and MatBadge sharing same injector, I can inject MatBadge instance to my Dir1 class constructor.

constructor(
    public badge:MatBadge,
)

Then I try to change the badge.content inside on my OnInit function of my Dir1 class

ngOnInit(): void {
   this.badge.content="22"
}

... and nothing

But when I try to make same for badge.color, which is another @Input that MatBadge directive has, it works...

Help please!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!