admin管理员组文章数量:1189003
trying to minimize initial bundle of my web app with angular v19, primeng. when providing primeng in app.config.ts like this:
export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({
theme: {
preset: Aura
}
})
]
};
all styles of primeng is included in root(initial) styles.css file, which will be bigger styles file and that affects my initial loading time. In my case I don't want that, I am using primeng only in one standalone component, let's say PriceComponent, which is lazy loaded component. That is why I want to provide and utilize primeng things in PriceComponent only, not globally. Is there a way to remove providePrimeNG from app.config.ts and provide same thing in PriceComponent only?
What I did so far:
@Component({
selector: 'app-price-list',
imports: [
TabsModule,
CommonModule
],
providers: [
{ provide: PRIME_NG_CONFIG, useValue: { theme: Aura } },
],
templateUrl: './price-listponent.html',
styleUrl: './price-listponent.scss',
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class PriceListComponent implements OnInit, AfterViewInit {
which did not work. Does anyone have suggestions about how to achieve this? Thanks in advance for your time.
本文标签: angularProvide Primeng in standalone component with themeStack Overflow
版权声明:本文标题:angular - Provide Primeng in standalone component with theme - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738371387a2082553.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论