[Solved] can’t understand Angular 2


Without any additional information, it looks like you haven’t given the component’s metadata a selector. The selector identifies a matching HTML element in the app’s index.html file to insert the component’s HTML.

An example:
index.html

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>My App</title>
  <base href="https://stackoverflow.com/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root>Loading...</app-root> // <-- OUR SELECTOR ELEMENT
</body>
</html>

app.component.ts

@Component({
  moduleId: module.id,
  selector: 'app-root', // <-- MATCHING SELECTOR
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})


export class AppComponent {
    // ...

1

solved can’t understand Angular 2