Open Closed

Lazyloadin styles not applying in angular #6840


User avatar
0
smansuri created
  • ABP Framework version: v7.3.2

  • UI Type: Angular

  • Database System: EF Core (MySQL)

  • Tiered (for MVC) or Auth Server Separated (for Angular): no

  • Exception message and full stack trace: NA

  • Steps to reproduce the issue: NA

i have used below link to lazyload styles inside my appcomponent.ts
https://docs.abp.io/en/abp/latest/UI/Angular/Lazy-Load-Service

var tenant = this.config.getOne("currentTenant");
console.log(tenant)
this.lazyLoadService.load(
LOADING_STRATEGY.AppendAnonymousStyleToHead('../../assets/'+tenant.name+'styles.scss'),
).subscribe(res=> console.log(tenant));
this is appneding the styles in head tag but i do not see any effect from the lazyloaded styles.


3 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello,

    I have applied the code like below
    image.png

    And created one TenantNamestyle.scss file with the code
    image.png

    it result like
    image.png

    Please give it a try.

    Thanks

  • User Avatar
    0
    smansuri created

    Hello,

    I have applied the code like below
    image.png

    And created one TenantNamestyle.scss file with the code
    image.png

    it result like
    image.png

    Please give it a try.

    Thanks

    Its not working for me. Do we need to reference this TenantNamestyle.scss in angular.json file?
    im getting below error :
    Refused to apply style from 'http://testdev.localhost:4200/teststyles.scss' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

  • User Avatar
    0
    smansuri created

    After removin // comments and convertin it to /* comments and changing the file extension from scss to css worked.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08