I recently watched a video tutorial (link: https://www.youtube.com/watch?v=z4JUm0Bq9AM) and encountered some errors in my CLI. The specific errors are as follows:
- ERROR in sidebar.component.ts(12,5): error TS7028: Unused label.
- sidebar.component.ts(14,56): error TS2339: Property 'currentUrl' does not exist on type 'SidebarComponent'.
The section of code that is causing the errors is shown below:
constructor(private router: Router) {
currentUrl: String;
router.events.subscribe((_: NavigationEnd) => this.currentUrl = _.url)
}
In the tutorial, from timestamp 48:14 to 49:18, the presenter did not encounter any errors with this exact code. However, when I tried it in Visual Studio Code, both instances of `currentURL` were underlined. I am struggling to understand why this discrepancy exists and how to resolve it.
One difference I noticed between our codes is that I used uppercase 'String' instead of 'string', which actually led to a different error initially.
If anyone can provide insight into this issue, it would be greatly appreciated. Thank you!