0

I have a _color.scss file. I have a $primaryImageURL which stores the location of an image. Is it possible to update this variable from an Angular Service. I fetch the location details from a get call from my angular service. An image gets uploaded from another service and Am trying to update the location of the primary image dynamically.

// _color.scss
$primaryImageURL = 'src/assets/img/primaryImage.png';

//Service
someService.getPrimaryColor().subscribe(data => {
  const brandingImg = data.brandImgUrl;
  // Need to update $primaryImageURL here dynamically. 
});

Thanks in Advance.

1 Answer 1

1

You cannot update a SCSS variable from an Angular variable. SCSS is being compiled during the build to a CSS file. What you can do is store the primary image url into one variable in the component and then bind it via [src]="...".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.