I am currently working through the Heroes Tutorial to learn Angular. However, I have encountered an issue where nothing displays on the page after creating the project, generating the component, and modifying the HTML. This is not the expected outcome. https://i.sstatic.net/s9SZA.png Can someone help me troubleshoot this? Any assistance would be greatly appreciated!
Below are the code snippets I have been using:
https://i.sstatic.net/5QLJU.png
heros.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-heros',
templateUrl: './heros.component.html',
styleUrls: ['./heros.component.css']
})
export class HerosComponent implements OnInit {
hero="WindStorm"
constructor() {}
ngOnInit(): void {
}
}
heros.component.html
<h2>{{hero}}</h2>
app.component.html
<h1>
{{title}}
</h1>
<app-heros></app-heros>
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HerosComponent } from './heros/heros.component';
@NgModule({
declarations: [
AppComponent,
HerosComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app-routing.modules.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {HerosComponent} from './heros/heros.component'
const routes: Routes = [{path:'', component:HerosComponent}];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }