This is our C# model;
public class Foo
{
public bool IsAllowed {get; set;} = false;
}
We would like to read this property in JS;
let isAllowed = '@Model.IsAllowed' === '@true';
if (isAllowed)
{
console.log('Allowed reading..');
}
else
{
console.log('Reading not allowed..');
}
Reference
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
![Favorite Favorite](/wp-content/plugins/wp-favorite-posts/img/star.png)
![Loading Loading](/wp-content/plugins/wp-favorite-posts/img/loading.gif)