angularjs-morph

compile angularjs components dynamically

Usage no npm install needed!

<script type="module">
  import angularjsMorph from 'https://cdn.skypack.dev/angularjs-morph';
</script>

README

angularjs-morph

npm version npm

sometimes the type of component you want to render will change depending on some input. this is a component that morphs in a specified component.

install

npm install angularjs-morph

usage

angular.module('myApp', ['angularjs-morph'])

<morph-into tag="a" attrs="{ title: 'DuckDuckGo', href: 'https://duckduckgo.com' }">
  Search
</morph-into>

api

tag=

string. a tag name.

attrs=

object. every value will be assigned to an attribute of the key's name

text

any text added inside the element will be rendered as the inner text of the morphed component.

example

see example on netlify

or run it yourself:

git clone https://github.com/kareniel/angularjs-morph
cd angularjs-morph
npm install
npm start