Skip to content

matcake/react-angular-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Angular Wrapper

Useful for injecting React components to AngularJS.

How to use

  1. Install package
npm install --save react-angular-wrapper
  1. Import reactAngularWrapper function
import { reactAngularWrapper } from 'react-angular-wrapper'; 
  1. Create component
const ExampleComponent = (props) => (
    <div>
        <p>{props.name} works!<p>
        <p>{props.injected} also!</p>
    </div>
);
  1. Render it!
angular
    .module('exampleModule')
    .constant('injected', 'value')
    .component('exampleComponent', reactAngularWrapper(ExampleComponent, ['foo', 'bar'], ['injected']));

Note: Angular bindings (foo,bar) are automatically passed as props to React component. You can use Dependency Injection by giving 3rd argument (injected above).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published