1
I would like to interpret my component within my index.html, about.html, contact.html, and other pages.
I created the component using Angular cli.
The code inside my file app.modulets. 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., I didn’t even move it.
In my file navbar.module.ts this way:
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 { }
Already my file navbar-Components is 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() {
}
}
Inside my navbar.component.html file you have mine that you would like to import in index. And in index.html, I’m trying to call my componenet, but it won’t.
I need some solution, please.
Yes... then I had to pay attention to the concepts of routes to use the tags. Thank you Guilherme.
– Thiago Cunha