I am facing an issue with my application's route called home
. The content on this route is not being displayed; instead, only the menu from app.component
is shown. I believe I might be overlooking something obvious. Can someone assist me with this problem? Here is the code snippet:
This is Home.component:
import {Component} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'home',
templateUrl: `home.component.html`
})
export class HomeComponent{}
App.routing.ts:
import {ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {HomeComponent} from './home.component'
const appRoutes: Routes = [
{
path:'',
redirectTo: '/',
pathMatch: 'full'
},
{
path: 'home',
component: HomeComponent
},
]
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {HomeComponent} from './home.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent, HomeComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
and there's index.html:
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="css/meu-css.css">
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<base href="/">
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>