angular: Default encapsulation doesn't work after init in boostrapModule

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

const bootstrap = () =>
    platformBrowserDynamic().bootstrapModule(AppBrowserModule, {
        defaultEncapsulation: ViewEncapsulation.ShadowDom
    });

find example-avatar

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

I expect behavior to change encapsulation!

Please provide the environment you discovered this bug in (run ng version)

Angular 9
Node.js 16
npm 6

Anything else?

ps: other question why is there no property defaultChangeDetection in CompilerOptions?

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

So it’s not possible to set the default encapsulation with AOT?

@JoostK I don't understand what you mean by defaultChangeDetection.

I mean

const bootstrap = () =>
    platformBrowserDynamic().bootstrapModule(AppBrowserModule, {
        defaultEncapsulation: ViewEncapsulation.ShadowDom,
        defaultChangeDetection: ChangeDetectionStrategy.OnPush
    });
@Component({
  selector: 'app',
  template: 'hello world'  // default OnPush
})

That sounds like a feature request unrelated to this issue report. We don’t have any intentions to widen the JIT configuration options, quite the opposite: these options don’t work in AOT compilations (and never will) and we tend to prefer self-contained components.