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

244
Views
Angular 12: How to implement inheritance of super class and child classes (components), when parent uses private property as constructor arguments?

I have a super class (component) and a few child classes (components) and I need to check PLATFORM_ID in each of them (something like below):

//Parent
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';

export class SliderComponent implements OnInit {
  ...
  constructor(@Inject(PLATFORM_ID) private platformId: Object) {}
  ...
}

//Child
export class ProductsComponent extends SliderComponent implements OnInit {
  ...
  constructor(private pls: ProductsService) {
    super(); // <-- I don't want to pass smth. here because I'll need to import add. modules
  }
  ...
}

Could I implement the inheritance without importing Inject, PLATFORM_ID, etc.?

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!