easy-template-x-angular-expressions
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

easy-template-x-angular-expressions

Angular expressions support for easy-template-x.

Usage

For basic usage and how to write easy-template-x templates please read the main package docs.

To enable Angular expressions support set the scopeDataResolver option of the handler. You can also define custom filters, as seen below:

import { TemplateHandler } from "easy-template-x"
import { createResolver } from "easy-template-x-angular-expressions"

const handler = new TemplateHandler({
    scopeDataResolver: createResolver({
        filters: {
            upper: (input: string) => (input || "").toUpperCase(),
            lower: (input: string) => (input || "").toLowerCase()
        }
    })
});

You can then use templates like this one:

Input:

input template

Data:

 {
    myLoop: [
        {
            casing: "upper",
            item: {
                name: "Bla"
            }
        },
        {
            casing: "lower",
            item: {
                name: "Some"
            }
        },
    ]
}

Output:

output document

Resolver options

The resolver behavior is configurable, read more in the options file.

Package Sidebar

Install

npm i easy-template-x-angular-expressions

Weekly Downloads

754

Version

0.1.0

License

MIT

Unpacked Size

26.4 kB

Total Files

28

Last publish

Collaborators

  • alonrbar