a_main
a_main

Reputation: 567

Get error in Angular 7 ./src/app/app.component.ts Module not found: Error: Can't resolve

In new installed Angular I changed
app.components.ts file like this

import { Component } from '@angular/core';

@Component({
 selector: 'app-root',
 templateUrl: `<h1>Some Information</h1>`,
})
export class AppComponent {
  title = 'my-app';
}

But after compiling I am getting error

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

My app directory contains only two files app.component.ts and app.module.ts

Where is the problem ?

What is a right way to create component with inline template ?

Upvotes: 1

Views: 2897

Answers (1)

Reza
Reza

Reputation: 19933

One issue that I see in your code is using templateUrl while you are providing the actual template so instead of templateUrl use template

Upvotes: 2

Related Questions