I am new to Angular and I am trying to create a simple component, but I am facing an issue where my component is not showing up on the index page. Can someone please help me with this?
Here is my component named "List.Component.ts":
import { Component } from '@angular/core';
@Component({
selector:'navBar',
templateUrl:'./navBarTemplate.html'
})
export class navBar {
constructor(){
}
}
This is my template html code:
<ul>
<li>Test-1</li>
<li>Test-2</li>
<li>Test-3</li>
</ul>
I have imported my component in the "app.module.ts" file:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
//here is my component
import { navBar } from './List.Component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent, navBar ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
However, when I check the index page, all it shows is "Hello Angular."
My Index page looks like this:
<!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">
<!-- 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>
<NavBar></NavBar>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>