[Solved] Adding 2 components in my app.component.ts


do this:

import {Component} from 'angular2/core';
import {CoursesComponent} from './courses.component'
import {AuthorsComponent} from './authors.component'

@Component({
  selector: 'my-app',
  template: '<h1>My first Angular2 App</h1><courses></courses> <authors></authors>',
  directives: [CoursesComponent, AuthorsComponent],
})

export class AppComponent { }

btw, update your code based-on latest Angular version as this tutorial

https://angular.io/docs/ts/latest/guide/learning-angular.html

include your directives, pipe and other components to declarations array.

src/app/app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';

@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent/* other pipe, directive, component */ ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

1

solved Adding 2 components in my app.component.ts