Skip to content

ng new --viewEncapsulation Native|None|ShadowDom do nothing #13689

Closed

Description

@kekel87

🐞 Bug report

Command (mark with an x)

- [x] new

Description

Hi,
I try to start new project with default viewEncapsulation set to ShadowDom.
According to ng new documentation, i use --viewEncapsulation flag.

But once the project is generated and served, app-root does not have #shadow-root.
I tried all the other encapsulation but I do not see any result.

What is the expected result for this flag?
Set default shematic with "viewEncapsulation": "ShadowDom" in angular.json and generate app.component.ts with encapsulation: ViewEncapsulation.ShadowDom
OR
Add to main.ts :

bootstrapModule(AppModule, {
  defaultEncapsulation: ViewEncapsulation.ShadowDom
})

Currently it does neither of the two.

🔬 Minimal Reproduction

ng new view-test --skip-git --skip-install --viewEncapsulation ShadowDom
or
ng new view-test --skipGit --skipInstall --view-encapsulation Native
or
ng new view-test --skipGit --skipInstall --viewEncapsulation None

🌍 Your Environment

@angular/cli@7.3.1

Windows 10 64bit

Activity

  1. added this to the needsTriage milestone on Feb 16, 2019
  2. modified the milestones: needsTriage, Backlog on Feb 16, 2019
  3. alan-agius4 commented on Feb 16, 2019

    @alan-agius4
    Collaborator

    Hi, thanks for reporting this. The problem seems to be that encapsulation Is not being set in the component.

  4. kekel87 commented on Feb 17, 2019

    @kekel87
    Author

    What is the reason of this choice ? Why we don't set option globally in main.ts ?

  5. added 2 commits that reference this issue on Feb 19, 2019
    8979790
    2b2d356
  6. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 9, 2019
  8. added a commit that references this issue on May 29, 2026
    1d7cd94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions