react-angular
Access your Angular application from within React.
Installation
npm install angular-react react prop-types react-dom
Simple component example
A typical React component receiving props
const app = angular { return <div> The value is: propsvalue </div> }
Nesting Angular
const app = angular appconst ExampleAngularComponent = { return <div> React rending Angular <ExampleAngularComponent /> </div> }
Complex component example
A React component that depends on Angular services.
Assume a Counter
service exists and the React component requires it
; const app = angular // Define the component dependencies (resolves, services, etc)const connect = // Your React component { return <div> <p>Count direction from CounterService: Counter</p> <p>Count from resolve: count</p> <p>Original from resolve: originalCount</p> <button onClick= Counter>+</button> <button onClick= Counter>-</button> </div> } // Register the component to be available in Angular