Mick
Mick

Reputation: 8913

Angular 2 hide component selectors

When examining Angular 2 Apps like Google Maps or YouTube i never see any component selectors like or in html source.

Is this default for production build? Or is it always needed for Angular 2 to work?

I got three problems with this:

  1. They dont look good (minor)
  2. They reveal my app is Angular 2 (minor)
  3. They break the CSS layout e.g. when using flexbox (major)

Upvotes: 0

Views: 1174

Answers (1)

Poul Kruijt
Poul Kruijt

Reputation: 71911

It's always needed. Google Maps and YouTube are not made with angular. Check https://material.angular.io/. This site from google/angular is made with angular. If you inspect the elements you see all the selectors: <app-homepage>, <router-outlet>.. etc. That's just how it works. They are not going to port such big code bases as Google Maps or YouTube to a new framework :)

  1. It actually gives a nice semantic structure if you ask me, instead of a random div you get a component selector. So you know exactly what that component is doing.
  2. Yes, you are using the latest technology out there, can't really be a negative :)
  3. In what way are they breaking your layout? If they are, it kinda means you are not using it right, or you are expecting a different result than given. Perhaps post a code example or a fiddle where it 'breaks' for you?

Upvotes: 1

Related Questions