1.2.0 • Published 4 years ago

react-to-angularjs v1.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

ReactToAngularjs

Helps you to migrate yours AngularJs Application to React component by component

Author: Guima Ferreira

ReactToAngularjs~R2AComponents(mod, components, theme)

Generate AngularJs Components

Kind: inner method of ReactToAngularjs

ParamTypeDescription
modStringAngularJs Module name
componentsArraycollection of AngularJs Components to be generated
themeReactComponenta react component that returns {children}

Example

[
 //  <my-component name="vm.name" on-change="vm.onChange"></my-component>
 {
     name: 'myComponent',
     react: MyComponent,         // a React Component imported
     props: ['name', 'onChange']
 },
 //  <simple-component></simple-component>
 {
     name: 'simpleComponent',
     react: SimpleComponent      // a React Component imported
 }
]

Example

// Attention!
// When passing functions that change its scope,
// you need to do bind(this) as following:
class MyController {
     constructor() {
         this.name = "William";
         this.onChange = this.onChange.bind(this);
     }

     onChange() {
         this.name = "Bill";
     }
}
// Or do this:
class MyController {
     constructor() {
         this.name = "William";
     }

     onChange = () => {
         this.name = "Bill";
     }
}

ReactToAngularjs~R2AComponent(component, bindingNames, theme)

Returns AngularJs Component config object that renders a React Component

Kind: inner method of ReactToAngularjs

ParamTypeDescription
componentClassReact Component Class
bindingNamesArrayAngularJs Component Attributes
themeReactComponenta react component that returns {children}

Example

R2AComponent("myComponent", ['name', 'onChange']);
1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago