In the data that I send to a Google Closure template, I have a property named default
. I plan on compiling both the JavaScript code and the code generated by SoyToJsSrcCompiler using the Google Closure Compiler. But the problem is that the generated code from the template prevents the compiler from renaming the default
property.
This is the template code:
/**
* @param test
*/
{template .template}
<div>{$test.a.b.default.c.d}</div>
{/template}
And this is the generated code:
/**
* @param {Object.<string, *>=} opt_data
* @param {(null|undefined)=} opt_ignored
* @return {string}
* @notypecheck
*/
test.template = function(opt_data, opt_ignored) {
return '<div>' + soy.$$escapeHtml(opt_data.test.a.b['default'].c.d) + '</div>';
};
Is there any way I can get:
opt_data.test.a.b.default.c.d
intead of:
opt_data.test.a.b['default'].c.d
or any other way in which I can keep my property named default
?
Right now, the compiler renames the default
property in my JavaScript code, but doesn't rename it in the code generated by SoyToJsSrcCompiler, because this code uses the quoted version.
There doesn't currently seem to be any supported way of doing this. I changed the name of the property from default
to something else that gets renamed properly.