Can't get #if to work
See original GitHub issueHello, I’m struggling to get #if to work with compiled templates. Everything else seems to work OK and the template works on a JSFiddle I have with the same data.
http://jsfiddle.net/nickhow83/xsry8msk/
My problem is that I use a truthy value for the server property but the #if block isn’t evaluating it and rendering the content.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
8 Reasons You Have No Motivation To Work (And How to ...
If you have no motivation to work, you might be having a hard time staying focused, are feeling particularly exhausted, or are just...
Read more >6 reasons why Intermittent Fasting is not working for you
If you cannot keep up with it, you may end up eating more calories than usual, leading to unhealthy weight gain.
Read more >12 Reasons You're Not Losing Weight With Intermittent ...
Intermittent fasting can help aid weight loss, unless you overeat in your window, eat unhealthy foods, and more. Here, an RD shares big ......
Read more >6 Reasons Why Intermittent Fasting Is Not Working For You
The plan doesn't work if your approach is wrong. You need to find the right way of fasting before you'll see any real...
Read more >Check what benefits to claim if you're sick or disabled
If you can't work because you're sick or disabled. If you're employed but you can't work, you'll usually get Statutory Sick Pay (SSP)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just ran into this as well with string properties on a dynamic object. The .Value work-around may get me by, but would be great if it worked as expected. I’ll do some digging into the unit tests & see if I can figure something out.
UPDATE: Deserializing explicitly to ExpandoObject rather than dynamic resulted in the expected behavior.
@randylsu’s comment directly above yours notes the solution:
Implicit deserialization in Newtonsoft produces a JObject, which is a specialized kind of object specific to Newtonsoft that Handlebars.Net doesn’t understand. If you explicitly deserialize your JSON to a BCL type like Expando or a POCO, you’ll find it behaves as expected (and also performs about 10x faster).