Closed Lighttree closed 5 years ago
Seems like not all code fails. For example I had following:
ViewModel:
contextTitle: {
value() {
return this.context
.split('_')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}
}
Stache:
<h1>
{{contextTitle.split(' ')[0]}} <span class="styled">{{contextTitle.split(' ')[1]}}</span>
</h1>
This case fails.
I found some workaround for my case that works:
ViewModel:
contextTitle: {
value() {
return this.context
.split('_')
.map(word => word.charAt(0).toUpperCase() + word.slice(1));
}
}
Stache:
<h1>
{{contextTitle[0]}} <span class="styled">{{contextTitle[1]}}</span>
</h1>
... some other place ...
<h2 class="headline2">
{{ i18n('txt_my_events_lbl', event_type=contextTitle.join(' ')) }}
</h2>
It was never possible to evaluate all JS expression types. However, these call expressions should work.
Given the error, I'm not sure this is a stache problem.
How often can you reproduce it?
JavaScript
statement inside{{expressions}}
throwsTypeError
:Steps to reproduce:
https://codepen.io/Lighttree/pen/eQjzwy?editors=1010
Expected results:
Before it was possible to evaluate
JavaScript
inside{{expressions}}
.Actual results:
Inline
JavaScript
evaluation doesn't work anymore.Environment: