1.0.0 • Published 6 years ago

angular-mount-react v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Angular mount React

Angular directive to integrate React components into angular application

Build Status Maintainability Test Coverage

How to use

const HelloComponent = ({ name, upperCase }) => {
  return (
    <span>
      {upperCase(`Hello ${name}`)}
    </span>
  );
};

angular.module('app', [mountReact().name])
  .factory('upperCase', () => {
    return (string) => string.toUpperCase()
  })
  .component('hello', {
    template: `
      <mount-react component="$ctrl.component" props="{name: $ctrl.name}" inject="['upperCase']">
      </mount-react>
    `,
    controller: () => {
      return {
        component: HelloComponent
      };
    },
    bindings: {
      name: '@'
    }
  });

For a full example