I'd like to interpret my component within my index.html, about.html, contact.html, among other pages.
I created the component using the Angular cli.
The code inside my app.module.ts file is:
import { AppComponent } from './app.component';
import { NavbarModule } from './navbar/navbar.module';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
NavbarModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
In my app.components , I did not even move.
In my navbar.module.ts file it looks like this:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NavbarComponent } from './navbar.component';
@NgModule({
imports: [
CommonModule
],
declarations: [
NavbarComponent
],
exports: [
NavbarComponent
]
})
export class NavbarModule { }
My navbar-components file looks like this:
import {Component, OnInit} from '@ angular / core';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Within my file navbar.component.html has mine that I would like to import into the index. And in index.html, I'm trying to call my componenet, but it will not.
I need some solution, please.