After spending more than 7 days on this issue, I am at a loss. No matter how hard I try, I can't seem to get it to work. Every time I include the path to the template in the children
, it results in an error and crashes the application.
Here's the code snippet:
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 included <base href="/">
in the index.html file but unfortunately, that didn't resolve the issue.
As a beginner in Angular2, I hope you all can forgive any naive questions I may ask.
EDIT: The placement of this code is crucial within the children
due to the use of router-outlet
.
Thank you for your help.