1

I am starting a developement of a big project and I need to know if to use ViewEncapsulation None or Emulated. From some reason the default is Emulated but I noticed that Angualr2 Material uses None.

We need to have reusable widgets within the projects and have different styles and also dynamic themes. I know it's can be done with Emulated but is seems more difficult to manage and not as simple as using CSS rules or override.

What should be the recommended mode for such a project?

Coding Duchess
  • 6,445
  • 20
  • 113
  • 209
sbenyo
  • 21
  • 4
  • Possible duplicate of [Angular 2 native view encapsulation](http://stackoverflow.com/questions/38255385/angular-2-native-view-encapsulation) – valepu Jul 21 '16 at 15:03

2 Answers2

1

The recommended way is using the Emulated option. It will give you the ability to encapsulate your component, not only the HTML template, but also the styles.

This is the future. It is called web components and I strongly advise you to read about it. For more details, see:

Leigh
  • 28,765
  • 10
  • 55
  • 103
almog
  • 798
  • 1
  • 7
  • 18
1

The benefits of using 'Emulated' option is, that You will be able to create encapsulated components(styles, template, etc.). Also it will help You to not only create component once(dropdown, table, popup) and reuse it within your current project, but also it can be used in different projects later or being open-sourced, if You will.