All Projects → Tonkean → angulareact

Tonkean / angulareact

Licence: MIT license
A way to seamlessly integrate React and AngularJS

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to angulareact

mey
A react package that exports hooks for handling the request lifecycle.
Stars: ✭ 18 (+5.88%)
Mutual labels:  hooks
AngularJS1.x-webpack-seed
使用angular1.5 + es2015 + webpack 练习demo
Stars: ✭ 18 (+5.88%)
Mutual labels:  angularjs
manager
OVHcloud Control Panel
Stars: ✭ 153 (+800%)
Mutual labels:  angularjs
Simplified-JNA
Multi-threaded JNA hooks and simplified library access to window/key/mouse functions.
Stars: ✭ 30 (+76.47%)
Mutual labels:  hooks
stook
A minimalist design state management library for React.
Stars: ✭ 86 (+405.88%)
Mutual labels:  hooks
ng-highcharts
Angular Directive for Highcharts
Stars: ✭ 12 (-29.41%)
Mutual labels:  angularjs
vote
Abakus' Voting System
Stars: ✭ 25 (+47.06%)
Mutual labels:  angularjs
angularjs-jest
Testing AngularJS applications with Jest
Stars: ✭ 24 (+41.18%)
Mutual labels:  angularjs
use-redux-hook
A simple react hook to get access to redux store
Stars: ✭ 13 (-23.53%)
Mutual labels:  hooks
pretty-resume
Generate a pretty resume! Templates based on salomonelli/best-resume-ever.
Stars: ✭ 41 (+141.18%)
Mutual labels:  angularjs
react-zeno
The React companion to Zeno, a Redux implementation optimized for Typescript.
Stars: ✭ 14 (-17.65%)
Mutual labels:  hooks
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (+41.18%)
Mutual labels:  hooks
jedisdb
redis like key-value state management solution for React
Stars: ✭ 13 (-23.53%)
Mutual labels:  hooks
use-query-string
🆙 A React hook that serializes state into the URL query string
Stars: ✭ 50 (+194.12%)
Mutual labels:  hooks
schema.tl
📜 Easy-to-use TL-Schema viewer
Stars: ✭ 55 (+223.53%)
Mutual labels:  angularjs
hookuspocus
hooks for all the functions!
Stars: ✭ 60 (+252.94%)
Mutual labels:  hooks
symfony-angular-todomvc
An implementation of TodoMVC using AngularJS and Symfony REST Edition
Stars: ✭ 94 (+452.94%)
Mutual labels:  angularjs
coconat
🍥 StarterKit Builder for rocket-speed App creation on 🚀 React 17 + 📙 Redux 4 + 🚠 Router 5 + 📪 Webpack 5 + 🎳 Babel 7 + 📜 TypeScript 4 + 🚔 Linters 23 + 🔥 HMR 3
Stars: ✭ 95 (+458.82%)
Mutual labels:  hooks
angular-8-boilerplate
Angular 8 Boilerplate with bootstrap
Stars: ✭ 23 (+35.29%)
Mutual labels:  angularjs
ng-webcam
ngWebcam is an AngularJS directive for capturing images from your computer's camera, and delivering then to you as data uri.
Stars: ✭ 14 (-17.65%)
Mutual labels:  angularjs

angulareact

npm license top language

A way to seamlessly integrate React and AngularJS.

Great for projects slowly migrating from AngularJS to React, supports using React components in AngularJS and vice versa with full component functionality, bindings and existing angular services.

Installation

The package can be installed via npm:

npm install angulareact --save

Or via yarn:

yarn add angulareact

You will need AngularJS 1.5 or newer, and React 16.8 or newer.

Setup

Add the React component <ReactToAngularPortals /> to your DOM:

ReactDOM.render(<ReactToAngularPortals />, document.querySelector('#react-root'));

For a more information about ReactToAngularPortals click here.

Usage

reactToAngular

Convert a React component to AngularJS

The most basic use of the reactToAngular can be described with:

const SomeComponent = ({ firstName, onClick }) => {
    return <button onClick={onClick}>Greet {firstName}</button>;
};

angular.module('myModule').component(
    'someCompoennt',
    reactToAngular(SomeComponent, ['firstName', 'onClick'])
);

After the conversion you can use the component like so:

<some-component first-name="data.firstName" on-click="onClick"></some-component>

Note: All the bindings in the component will be of type <, which means that to pass a callback, you should pass its reference and not execute it in the prop.

For a more information about reactToAngular click here.

angularToReact

Converts an AngularJS component to React.

The most basic use of the angularToReact can be described with:

const SomeAngularComponent = angularToReact('some-angular-component', angular.module('myModule'));

const SomeComponent = ({ name }) => {
    return <SomeAngularComponent name={name} />;
};

For a more information about angularToReact click here.

useAngularService

A hook to get an AngularJS service.

The most basic use of the angularToReact can be described with:

const Greeting = ({ userId }) => {
    const [user, setUser] = useState([]);

    const $http = useAngularService('$http');

    useEffect(() => {
        $http.get(`user/${userId}`).then(response => setUsers(response.data));
    }, [userId])

    return (
        <strong>
            Hello, {user?.name || 'buddy'}!
        </strong>
    );
}

For a more information about useAngularService click here.

useAngularWatch

A hook used for watching on changes during digest cycles.

The most basic use of the angularToReact can be described with:

 const UsernameThatUpdates = () => {
    const userService = useAngularService("userService");
    const [username] = useAngularWatch(() => userService.currentUser.name);

    return (
        <strong>
            { username }
        </strong>
    );
};

For a more information about useAngularWatch click here.

Caveats

If you want to use one of the hooks or angularToReact in a component that is not a descendent of a component that was added using reactToAngular, you must wrap your React root with AngularInjectorContext and pass the AngularJS injector:

angular.module("myModule")
    .run(['$injector', ($injector) => {
        ReactDOM.render(
            <AngularInjectorContext.Provider value={$injector}>
                <YourReactRoot />
            </AngularInjectorContext>,
            document.querySelector('#react-root'),
        );
    }])

License

Licensed under MIT license, see LICENSE for the full license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].