Open oscaruribe opened 7 years ago
I found a temporary fix to this. If you set your JSON Property to be as follows:
{"SomeTest" : { "anyString" : true } }
The if/else logic will work.
Since this is an ugly fix, let me know if anyone has any better fixes.
When passing dynamically parsed data from Newtonsoft (JToken) all values are IEnumerable but .Any() returns false for non-arrays so all #if tests fail.
Say the template looks like this:
{{#if SomeTest }} Value if true or non-empty {{/if}}
And the dynamic data passed is parsed from JSON as
{ "SomeTest": true } or { "SomeTest": "true" }
In both cases the following line in ConditionTagDefinition.isConditionSatisfied:
IEnumerable enumerable = condition as IEnumerable;
will return an enumerable no matter what the JToken holds as value. Then the following lines:
if (enumerable != null) { return enumerable.Cast<object>().Any(); }
Will return false.
Any ideas?