https://github.com/angular-libs/ng-react-router
Router to render react routes in a Angular application
https://github.com/angular-libs/ng-react-router
Last synced: 25 days ago
JSON representation
Router to render react routes in a Angular application
- Host: GitHub
- URL: https://github.com/angular-libs/ng-react-router
- Owner: angular-libs
- License: mit
- Created: 2017-08-05T11:06:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-23T04:16:10.000Z (almost 9 years ago)
- Last Synced: 2026-05-09T10:07:49.197Z (about 1 month ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ng-react-router [](https://travis-ci.org/angular-libs/ng-react-router)
Router to render react routes in a Angular application
### install
`npm i ng-react-router`
### example
`react-page.js`
```javascript
const ReactPage = ()=> `
this is react page
`;
export default const routes= [{
path:'react-page',
component:ReactPage
}]
```
`angular-app.js`
```javascript
import { provider } from 'ng-react-router'
angular.module('react-module', [
uiRouter , 'ng-react-router'
])
.config(($stateProvider, $urlRouterProvider) => {
"ngInject";
const options={
state:'react-module',
basePath:'/react-app',
routeResolver:(path)=> {
// path will be react-page
return System.import('./'+path).then((module=>module.default));
},
templateProvider:(err,uiView)=>{
if(err){
return `Page not found`
}
return `
React Page
${uiView}
`
}
};
provider(options,$stateProvider);
})
```
# License
[](/LICENSE)