https://github.com/alonrbar/easy-template-x-angular-expressions
Angular expressions support for easy-template-x
https://github.com/alonrbar/easy-template-x-angular-expressions
Last synced: 5 months ago
JSON representation
Angular expressions support for easy-template-x
- Host: GitHub
- URL: https://github.com/alonrbar/easy-template-x-angular-expressions
- Owner: alonrbar
- License: mit
- Created: 2021-02-13T19:57:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-15T19:21:59.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T18:12:12.435Z (6 months ago)
- Language: TypeScript
- Size: 208 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-angular - easy-template-x-angular-expressions - Angular expressions support for [easy-template-x](https://github.com/alonrbar/easy-template-x). (Table of contents / Angular)
- fucking-awesome-angular - easy-template-x-angular-expressions - Angular expressions support for <b><code> 433⭐</code></b> <b><code> 59🍴</code></b> [easy-template-x](https://github.com/alonrbar/easy-template-x)). (Table of contents / Angular)
README
# easy-template-x-angular-expressions
Angular expressions support for [easy-template-x](https://github.com/alonrbar/easy-template-x).
## Usage
For basic usage and how to write `easy-template-x` templates please read the main package [docs](https://github.com/alonrbar/easy-template-x).
To enable [Angular](https://angular.io/) expressions support set the `scopeDataResolver` option of the handler.
You can also define custom filters, as seen below:```typescript
import { TemplateHandler } from "easy-template-x"
import { createResolver } from "easy-template-x-angular-expressions"const handler = new TemplateHandler({
scopeDataResolver: createResolver({
angularFilters: {
upper: (input: string) => (input || "").toUpperCase(),
lower: (input: string) => (input || "").toLowerCase()
}
})
});
```You can then use templates like this one:
Input:

Data:
```javascript
{
myLoop: [
{
casing: "upper",
item: {
name: "Bla"
}
},
{
casing: "lower",
item: {
name: "Some"
}
},
]
}
```Output:

## Resolver options
The resolver behavior is configurable, read more in the [options file](https://github.com/alonrbar/easy-template-x-angular-expressions/blob/master/src/resolverOptions.ts).