{"id":13452623,"url":"https://github.com/coatue-oss/angular2react","last_synced_at":"2025-04-06T02:12:47.216Z","repository":{"id":18708162,"uuid":"84611647","full_name":"coatue-oss/angular2react","owner":"coatue-oss","description":"One line of code to turn any Angular 1 Component into a React Component","archived":false,"fork":false,"pushed_at":"2023-01-11T23:12:21.000Z","size":767,"stargazers_count":131,"open_issues_count":17,"forks_count":25,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-04-23T09:55:25.762Z","etag":null,"topics":["angular","angularjs","react","reactjs"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatue-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-11T00:18:56.000Z","updated_at":"2024-02-22T17:18:05.000Z","dependencies_parsed_at":"2023-01-13T19:58:19.035Z","dependency_job_id":null,"html_url":"https://github.com/coatue-oss/angular2react","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Fangular2react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Fangular2react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Fangular2react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Fangular2react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatue-oss","download_url":"https://codeload.github.com/coatue-oss/angular2react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423516,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angularjs","react","reactjs"],"created_at":"2024-07-31T07:01:29.515Z","updated_at":"2025-04-06T02:12:47.197Z","avatar_url":"https://github.com/coatue-oss.png","language":"TypeScript","readme":"\u003cimg alt=\"Angular to React: The easiest way to embed Angular components in a React app\" src=\"https://raw.githubusercontent.com/coatue-oss/angular2react/master/logo.png\" width=\"400px\" /\u003e\n\n# angular2react [![Build Status](https://img.shields.io/circleci/project/coatue-oss/angular2react.svg?branch=master\u0026style=flat-square)](https://circleci.com/gh/coatue-oss/angular2react) [![NPM](https://img.shields.io/npm/v/angular2react.svg?style=flat-square)](https://www.npmjs.com/package/angular2react) [![Apache2](https://img.shields.io/npm/l/angular2react.svg?style=flat-square)](https://opensource.org/licenses/Apache2)\n\n\u003e One line of code to turn any Angular 1 Component into a React Component (opposite of [react2angular](https://github.com/coatue-oss/react2angular))\n\n## Installation\n\n```sh\n# Using Yarn:\nyarn add angular2react angular angular-resource react react-dom @types/angular @types/react @types/react-dom\n\n# Or, using NPM:\nnpm install angular2react angular angular-resource react react-dom @types/angular @types/react @types/react-dom --save\n```\n\n## Usage\n\n### 1. Save a reference to the `$injector`\n\n```js\nlet $injector\nangular\n  .module('myModule')\n  .run(['$injector', function(_$injector) { $injector = _$injector }])\n```\n\n### 2. Create an Angular component\n\n```js\nconst MyComponent = {\n  bindings: {\n    fooBar: '\u003c',\n    baz: '\u003c'\n  },\n  template: `\n    \u003cp\u003eFooBar: {this.$ctrl.fooBar}\u003c/p\u003e\n    \u003cp\u003eBaz: {this.$ctrl.baz}\u003c/p\u003e\n  `\n}\n```\n\n### 3. Expose it to Angular\n\n```js\nangular\n  .module('myModule', [])\n  .component('myComponent', MyComponent)\n```\n\n### 4. Convert it to a React Component\n\n```js\nimport { angular2react } from 'angular2react'\n\nconst MyComponent = angular2react('myComponent', MyComponent, $injector)\n```\n\n### 5. Use it in your React code\n\n```js\n\u003cMyComponent fooBar={3} baz='baz' /\u003e\n```\n\n## Why step 1?\n\nWe need a reference to the `$injector` created by the Angular module that registered the Angular component you're exposing. That way we can manually compile your component.\n\nIf you use [ngimport](https://github.com/bcherny/ngimport), you can skip step 1 and omit the last argument in step 4:\n\n```js\nimport { angular2react } from 'angular2react'\n\nconst MyComponent = angular2react('myComponent', MyComponent)\n```\n\n## Full Examples\n\nhttps://github.com/bcherny/angular2react-demos\n\n## Caveats\n\n- Only one way bindings (`\u003c`) are supported, because this is the only type of binding that React supports\n- Be sure to bootstrap your Angular app before rendering its React counterpart\n\n## Tests\n\n```sh\nnpm test\n```\n\n## License\n\nApache-2.0\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatue-oss%2Fangular2react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatue-oss%2Fangular2react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatue-oss%2Fangular2react/lists"}