L
L
Lolut2017-09-23 21:25:29
Angular
Lolut, 2017-09-23 21:25:29

Problem when including app.component.ts?

Why does not the file want to be displayed on the page, I created the app.component.html file and connected it to app.component.ts. What could be wrong?
This is app.component.ts.

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

@Component({
  selector: 'my-app',
  template: 'app.component.html'
});
export class AppComponent  {}

This is app.component.html (They are all in the same folder)
<h1> My first Angular 2 App </h1>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Makito, 2017-09-23
@Lolut

the template decorator property is used for the built-in template, and you need to use templateUrl, in addition to this, you have a syntax error, remove the semicolon after the decorator declaration:

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent  {}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question