Currently, I am working through the Angular tutorial available on their website. In my quest to create various components, templates, and styles, I have hit a roadblock.
The issue lies in incorporating my styles into the components using the 'styleURLs' property of the '@Component' decorator. Here's a snippet of what I've attempted:
@Component({
selector: 'curries',
templateUrl: '../Views/curries.component.html',
styleUrls: ['../../../assets/styles/curries.component.css'],
providers: [CurryService]
})
export class CurriesComponent {
My attempt has been to place the styles within the 'assets/styles' folder, as illustrated above.
A glimpse at my current folder structure reveals:
/src
/app
/Views
/Components
/curries.component.ts
/Services
/Models
/assets
/images
/styles
-curries.component.css
One query that continues to bother me is whether it's feasible to house style documents in a separate folder and then reference them in the component.
This move is primarily driven by my desire to keep the files within the app directory organized. Besides, I stumbled upon suggestions indicating that images and styles ought to reside in the 'assets' folder for better structuring purposes.
Any assistance or guidance on this matter would be greatly appreciated :)
Psst! An error message pops up whenever I try to build the app:
ERROR in ./src/app/Components/curries.component.ts
Module not found: Error: Can't resolve
'../../../assets/styles/curries.component.css' in
'~\AngularProjects\HelloWorld\src\app\Components'
resolve '../../../assets/styles/curries.component.css' in
'~\AngularProjects\HelloWorld\src\app\Components'using
description file: ~\AngularProjects\HelloWorld\package.json (relative
path: ./src/app/Components)