diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 1fdac83492..e14bac94ed 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -436,6 +436,7 @@ var template2 = _.template("Hello {{ name }}!"); template2({ name: "Mustache" }); _.template("Using 'with': <%= data.answer %>", oldTemplateSettings)({ variable: 'data' }); +_.template("Using 'with': <%= data.answer %>", { variable: 'data' })({ answer: 'no' }); _(['test', 'test']).pick(['test2', 'test2']); diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 760a6dca78..87ca861d7b 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -39,6 +39,12 @@ declare module _ { * Default value is '/<%-([\s\S]+?)%>/g'. **/ escape?: RegExp; + + /** + * By default, 'template()' places the values from your data in the local scope via the 'with' statement. + * However, you can specify a single variable name with this setting. + **/ + variable?: string; } interface Collection { }