I am encountering an issue with the 'strictNullChecks' setting in my Angular project. This has resulted in numerous errors across my templates (.html), such as:
<input
#inputValue
type="text"
(keyup.enter)="showStyle(inputValue.value)"
/>
<p id="addStyle" style="color: blue; display: none" #hide>HELLO</p>
This error is also present in my TypeScript (.ts) files:
addingStyle = window.document.getElementById("addStyle") as HTMLParagraphElement;
showStyle(inputValue: string) {
if (inputValue === "help") {
this.addingStyle.style.display = "block";
console.log("help");
} else {
console.log("it worked");
}
}
Specifically, the error being displayed is:
Object is possibly 'null'.