简体   繁体   中英

How can i use associative array name @type in Handlebars?

Is it possible to use {{@type}} in a way without deactivating @data in Handlebars?

Dataexample:

var data = {"@type" : "test"}

Is there an escape such as {{\\@type}} or something similar?

Found a solution. Just using helpers:

Handlebars.registerHelper("escape", function(obj, name) {
    return obj[name];
});

And then just use

{{escape this "@type"}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM