{"repo":"taiga-family/polymorpheus","free":true,"listed":false,"github":"https://github.com/taiga-family/polymorpheus","clone":"git clone https://github.com/taiga-family/polymorpheus.git","description":"Polymorpheus is a tiny library for polymorphic templates in Angular.","language":"TypeScript","stars":414,"topics":["angular","template","templates","ng-template","polymorphic","customization","hacktoberfest"],"license":"Apache-2.0","category":"saas-starters-boilerplates","readme_excerpt":"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 : Content accepts: - primitives like number or string - functions that take context as argument and return a primitive - templates that get instantiated with given context - components that would get context injected 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 (wait for packages to install and run npm start ). You can also read about this concept in detail. Accessing context in dynamic component If you use component content you can inject context with POLYMORPHEUS CONTEXT token or injectContext helper. Important: this object is live so if you change it, your component view will be updated as well automatically. Alternatively, inputs can be used and will be synced with according context keys: Adding type to template context You can use polymorpheus directive to add type to template context: Core team Alex Inkin Roman Sedov ng-polymorpheus is a part of ","default_branch":null,"files":null,"tree":[],"storefront":"/r/taiga-family","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/taiga-family/polymorpheus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}