I have lost over 7 days with this, but couldn't get it to work. When I put path to the template in the children, I get the error, and application crashes.
Here is my code:
export const routes: Routes = [
{path: 'store', component: StoreComponent,
children: [
{path: 'apple', component: AppleComponent}
]
}
AppleComponent.ts
import {Component, OnInit, Type} from '@angular/core';
import {Router, ActivatedRoute} from "@angular/router";
@Component ({
selector: 'apple',
templareUrl: '../apple.html
})
export class AppleComponent implements OnInit {
constructor(){}
nGOnInit():void{}
}
I have put the <base href="/"> in the index.html file but that didn't help.
I have just started learning Angular2, so please forgive me if I'm asking a stupid question.
EDIT: This would need to go in the children because of router-outlet.
Thanks guys.