question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't get #if to work

See original GitHub issue

Hello, 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
randylsucommented, Jan 11, 2018

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.

1reaction
rexmcommented, Mar 30, 2019

@randylsu’s comment directly above yours notes the solution:

Deserializing explicitly to ExpandoObject rather than dynamic resulted in the expected behavior.

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found