react2angularjs
Advanced tools
Sorry, the diff of this file is not supported yet
+10
-18
@@ -53,7 +53,5 @@ (function (global, factory) { | ||
| key: "getProps", | ||
| value: function getProps() { | ||
| var _this = this; | ||
| value: function getProps(elementScope) { | ||
| return this.propNames.reduce(function (props, propName) { | ||
| props[propName] = _this.elementScope[propName]; | ||
| props[propName] = elementScope[propName]; | ||
| return props; | ||
@@ -65,21 +63,15 @@ }, {}); | ||
| value: function link(scope, element, attrs, ctrl, transclude) { | ||
| this.$container = element[0]; | ||
| this.$children = transclude(); | ||
| this.elementScope = scope; | ||
| this.render(); | ||
| var $container = element[0]; | ||
| var $children = transclude(function () {}); | ||
| var children = (0, _createReactElements["default"])($children); | ||
| this.render(scope, $container, children); | ||
| this.$compile(element.contents())(scope.$parent); //re render on scope changes | ||
| this.elementScope.$watchGroup(Object.keys(this.elementScope.$$isolateBindings), this.render.bind(this)); | ||
| scope.$watchGroup(Object.keys(scope.$$isolateBindings), this.render.bind(this, scope, $container, children)); | ||
| } | ||
| }, { | ||
| key: "render", | ||
| value: function render() { | ||
| var props = this.getProps(); | ||
| if (!this.memoized) { | ||
| var children = (0, _createReactElements["default"])(this.$children); | ||
| this.memoized = children; | ||
| } | ||
| (0, _reactDom.render)( /*#__PURE__*/_react["default"].createElement(this.ReactComponent, props, this.memoized), this.$container); | ||
| value: function render(elementScope, $container, children) { | ||
| var props = this.getProps(elementScope); | ||
| (0, _reactDom.render)( /*#__PURE__*/_react["default"].createElement(this.ReactComponent, props, children), $container); | ||
| } | ||
@@ -86,0 +78,0 @@ }]); |
+1
-1
| { | ||
| "name": "react2angularjs", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "A fully functional way to integrate React components in Angular 1 apps!", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+14
-16
@@ -24,5 +24,5 @@ import React from 'react'; | ||
| getProps() { | ||
| getProps(elementScope) { | ||
| return this.propNames.reduce((props, propName) => { | ||
| props[propName] = this.elementScope[propName]; | ||
| props[propName] = elementScope[propName]; | ||
| return props; | ||
@@ -33,26 +33,24 @@ }, {}); | ||
| link(scope, element, attrs, ctrl, transclude) { | ||
| this.$container = element[0]; | ||
| this.$children = transclude(); | ||
| this.elementScope = scope; | ||
| const $container = element[0]; | ||
| const $children = transclude(function() {}); | ||
| const children = createReactElements($children); | ||
| this.render(); | ||
| this.render(scope, $container, children); | ||
| this.$compile(element.contents())(scope.$parent); | ||
| //re render on scope changes | ||
| this.elementScope.$watchGroup(Object.keys(this.elementScope.$$isolateBindings), this.render.bind(this)); | ||
| scope.$watchGroup( | ||
| Object.keys(scope.$$isolateBindings), | ||
| this.render.bind(this, scope, $container, children) | ||
| ); | ||
| } | ||
| render() { | ||
| let props = this.getProps(); | ||
| render(elementScope, $container, children) { | ||
| let props = this.getProps(elementScope); | ||
| if (!this.memoized) { | ||
| let children = createReactElements(this.$children); | ||
| this.memoized = children; | ||
| } | ||
| render( | ||
| <this.ReactComponent {...props}>{this.memoized}</this.ReactComponent>, | ||
| this.$container | ||
| <this.ReactComponent {...props}>{children}</this.ReactComponent>, | ||
| $container | ||
| ); | ||
| } | ||
| } |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
17493
26.72%10
11.11%289
-2.03%1
Infinity%