I have a shared service file which defines a variable liks this:
export class SharedService {
activeModal: String;
}
Then I have a component file that imports the service and defines it:
constructor(public sharedService: SharedService) {
}
In that component's template file I check the value of the modal:
<div *ngIf="sharedService.activeModal === 'login'"></div>
Everything works fine, but in the editor, the sharedService.activeModal === 'login' part get's a red squiggly line under it and hover over it shows this linting error:
[Angular] Expected the operants to be of similar type or any
property sharedService of ModalComponent
Any ideas what I'm doing wrong?
Try lowercase string
(the primitive, rather than the wrapper object type String
) in the declaration of activeModal
.
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