user33276346
user33276346

Reputation: 1739

ERROR in ./src/app/svg.component.ts Module not found: Error: Can't resolve './svg.component.svg'

There is a live example from the official doc thats not working: https://angular.io/generated/live-examples/template-syntax/stackblitz.html

The live example error says: Import error, can't find file: ./svg.component.svg

If I download the example and npm install it, I got the error:

ERROR in ./src/app/svg.component.ts
Module not found: Error: Can't resolve './svg.component.svg' in 'C:\Users\Elias\Desktop\New folder\src\app'

The svg.component.ts has this portion of code:

import { Component } from '@angular/core';
@Component({
  selector: 'app-svg',
  templateUrl: './svg.component.svg',

It seems that the component is asking for an .svg file. I don't know how to get it.

Upvotes: 0

Views: 1404

Answers (1)

Nadhir Falta
Nadhir Falta

Reputation: 5267

You are trying to reference a file that don't exist, and you are trying to reference an svg template from a css which also won't work.

Just add a .svg file containing your svg template to your directory and that should work fine. See the image below.

enter image description here

Upvotes: 1

Related Questions