Package Exports
- @tinkoff/ng-polymorpheus
- @tinkoff/ng-polymorpheus/bundles/tinkoff-ng-polymorpheus.umd.js
- @tinkoff/ng-polymorpheus/fesm2015/tinkoff-ng-polymorpheus.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tinkoff/ng-polymorpheus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Polymorpheus
Polymorpheus is a tiny library for polymorphic templates in Angular.
It is 1 KB gzip, dependency free and allows you to make pretty cool things.
What does it do?
It abstracts over different ways of view customization in Angular with one simple structural directive:
<ng-container *polymorpheusOutlet="content as text; context: context">{{text}}</ng-container>Content accepts:
- primitives like
numberorstring - functions that take
contextas argument and return a primitive - templates that get instantiated with given
context - components that would get
contextinjected through DI
Context is optional when you need your content to adapt to the situation
How to use it?
Typical use case would be a component that accepts visual customization and defines context by itself. Say a menu list where you can configure how each item should look like by passing a template. And context would be item itself and, for example, whether it is focused or not.
Please see extensive demo.
You can also read about this concept in detail.