1

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 ?

1
  • 1
    Change templateUrl to template, and see if that helps. Commented Nov 22, 2018 at 13:55

1 Answer 1

2

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

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.