ng-attr

0.0.1 • Public • Published

ng-attr

<div ng-attr="{ 'attribute-name': scopeReference }"></div>

Directive for Angular 1.x for dynamic element attributes

Somewhat similar to ng-class buf to attributes.

Given:

angular
    .module('myApp')
    .component('myComponent', {
        template: '<div ng-attr="{ \'special-attribute\': $ctrl.attrValue }"></div>',
        controller: function() {
            this.attrValue = 'Hello gurls';
        }
    });

will be compiled to

<div ng-attr="{ 'attribute-name': scopeReference }" special-attribute="Hello gurls"></div>

Installation

  • npm i ng-attr --save
  • angular.module('yourModule', ['argshook.ngAttr'])

Package Sidebar

Install

npm i ng-attr

Weekly Downloads

3

Version

0.0.1

License

ISC

Last publish

Collaborators

  • argshook