I have written a following piece of code:
{{ 'xx' | assignTo: x }} {{ ('<h3>' + x + '</h3>') | raw | ifNotEmpty(x) }}
this does work when tested in the template evaluat on the http://templates.servicestack.net/docs/default-filters
but does not work when I’m trying it in my code (the unhandled expression is called).
using System;
using ServiceStack.Templates;
using System.Collections.Generic;
var context = new ServiceStack.Templates.TemplateContext(){
OnUnhandledExpression = f =>
{
throw new Exception("unknown binding " + f.BindingString);
return new byte[0];
}
}.Init();
var output = context.EvaluateTemplate("{{ 'xx' | assignTo: x }} {{ ('<h3>' + x + '</h3>') | raw | ifNotEmpty(x) }} ");
what is wrong? why does it behave different (properly, IMO) in the templates docs?