I want to use module joke.module.ts to specify multiple components; in this case I start with JokeComponent in joke/joke.module.ts in src/app
import { Component } from '@angular/core';/
@Component({
selector: 'joke',
template: `
<h1>What did the cheese say when it looked in the mirror?</h1>
<p>Halloumi (hello me)</p> `
})
export class JokeComponent {
}
In app.component.ts I want to use joke/joke.module.ts and use the tag 'joke'
import { Component } from '@angular/core';
import { JokeModule } from './joke/joke.module';
@Component({
selector: 'app-root',
template: `
<joke></joke>
`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
}
I have create module joke.module.ts in src/app/joke
import { NgModule } from '@angular/core';
import { JokeComponent } from './joke.component';
import { AppComponent } from '../app.component';
@NgModule({
imports: [ AppComponent ],
declarations: [
JokeComponent
],
entryComponents: [JokeComponent]
})
export class JokeModule { }
However, when I run the application I am getting the error Uncaught Error: Template parse errors: 'joke' is not a known element: 1. If 'joke' is an Angular component, then verify that it is part of this module.