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
Add to favorites