Format element based on boolean value

Use console.log to debug the code, check if the data is received they way you expected.