Skip to content

evaneus/AngularElements

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive Elements

AngularJS directives as native HTML elements (web components)

![Gitter](https://badges.gitter.im/Join Chat.svg)

Tiny Google Polymer or Mozilla X-Tags add-on which allows to use AngularJS components as custom HTML elements. Also works with a native Custom Elements implementation if present.

Demo

Example

Using component in HTML

<body>
	<my-angular-component items="{window.someArray}"></my-angular-component>
</body>

Angular directive definition

angular.module('demo', []).directive('angularList', function () {
    return {
        restrict: 'E',
        scope: {},
        template: '<ul><li ng-repeat="x in items">{{ x }}</li></ul>',
        link: function (scope) {
            scope.testMethod = function () {
                alert('Directive method called as node method');
            }
        }
    };
});

document.registerAngular('my-angular-component', 'demo');

Find complete examples in corresponding folder.

Nesting

Original content of a custom element is injected to component as:

<my-angular-component>Hello world</my-angular-component>

In this case we can use "Hello world" as transclude to "my-angular-component" directive.

Dependencies

License

MIT: http://mit-license.org/

Copyright 2015 Stepan Suvorov aka stevermeister, Denis Radin aka PixelsCommander

About

Allows to use AngularJS directive as HTML element

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 85.3%
  • JavaScript 14.7%