I got this issue where i cannot find the solution
As I saw router: Router
and router.url: string
. So I can't find any explanation why it's complaining in html when router.url === '/successlogin'
. Any idea?
Update: I changed type of router, router.url: String
and it's ok now but I think it should work the opposite. Why is this happening? Until now I thought type string
was the "right" one and not String
...
My code simplified:
HTML
<div *ngIf="!global.showUnauthorizedMessage || router.url === '/successlogin'" class="beforeFooter"></div>
<div *ngIf="!global.showUnauthorizedMessage || router.url ==='/successlogin'" id="footer">
Component
import { Router } from '@angular/router';
constructor( public router: Router) { code here }
This message is from the "Angular Language Service" extension in VSCode !
Probably an update because before I didn't have this message....
2 solutions I found is to use localeCompare()
like this:
router.url.localeCompare('/successLogin')===0
or
use String
instead of string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With