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

191
Views
Angular 2 typescript protected members in component templates

I was thinking about how could be possible implement some members in a component that could be accessed from the template but not from a parent component.

I searched for some information about the typescript visibility in angular 2 but I only found topics about "public" and "private" declarations but not about"protected".

So, does it make sense to use "protected" for this?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

the compiler warns me if i use in the html file a property which is declared private (although it works!). If i use protected, then no warns is emitted

about 4 years ago · Santiago Trujillo Report

0

some members in a component that could be accessed from the template but not from a parent component.

protected/private only make sense if you are doing component inheritance. This is now the thing you are discussing. Component composition doesn't impact your choice here.

about 4 years ago · Santiago Trujillo Report
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!