I am currently in the process of learning Angular 2. Despite encountering numerous error messages, I have successfully set up the routes and can now display the desired component. My next challenge is to incorporate a navbar component into my homepage component.
Here is the code for Home.ts:
import {Component, View} from 'angular2/core';
import {Navbar} from './navbar/navbar'
@Component({
selector: 'home'
})
@View({
templateUrl: '/app/home/home.html'
})
export class Home {
constructor:(public navbar: Navbar) {
}
}
This is the code for home.html:
<p>NICE!</p>
<navbar></navbar>
Here is the code for navbar.ts:
import {Component, View} from 'angular2/core';
@Component({
selector: 'navbar'
})
@View({
template: `
<ul>
<li>This is the navbar</li>
</ul>
`
})
export class Navbar{
}
Although the homepage is being displayed properly, the <navbar></navbar>
tag remains unchanged when inspected. What could be causing this issue?