We are getting an error Uncaught TypeError: Cannot read property 'yield' of undefined for the following hbs code;
<button {{if isButtonEnabled 'enabled' 'disabled'}}>Test</button>
isButtonEnabled is a property defined on my corresponding controller
The TypeError: Cannot read property of undefined is one of the most common type errors in JavaScript. It occurs when a property is read or a function is called on an undefined variable. TypeError: Cannot read properties of undefined (reading x) Undefined means that a variable has been declared but has not been assigned a value.
In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined.
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined.
You'll have to flip your condition and do this. I just had this exact problem and this was the solution.
<button disabled={{isButtonDisabled}}>Test<button>
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