angularjs 并对未定义的 属性 '__reactAutoBindMap' 作出反应

angularjs and react property '__reactAutoBindMap' of undefined

当我调用 MYCOMPONENT mixin 并将其传递给 React 时,我在 angularJS 海关指令中实现 Reactjs 0.13.1 时遇到问题我遇到了这个错误

TypeError: Cannot read property '__reactAutoBindMap' of undefined
    at ReactClass.createClass.Constructor (react-with-addons-0.13.1.js:6237)
    at Object.fn (ReceptionReactController.js:21)
    at Scope.$get.Scope.$digest (angular.js:14243)
    at Scope.$get.Scope.$apply (angular.js:14506)
    at done (angular.js:9659)
    at completeRequest (angular.js:9849)
    at XMLHttpRequest.requestLoaded (angular.js:9790)(anonymous function) @ angular.js:11607$get @ angular.js:8557$get.Scope.$digest @ angular.js:14261$get.Scope.$apply @ angular.js:14506done @ angular.js:9659completeRequest @ angular.js:9849requestLoaded @ angular.js:9790

我不知道为什么 __reactAutoBindMap 在 react 构造函数中未定义?

MYCOMPONENT.js

var MYCOMPONENT = React.createClass({
    displayName: 'MYCOMPONENT',
    render: function () {
        return React.DOM.div(null, "Rendering faster in AngularJs with ", this.props.framework);

    }
});

angular 查看

<body >
    <h1>Faster Rendering With ReactJs</h1>
    <div >
        <input ng-model="framework" />
        <hr>
        <fast-ng framework="framework"></fast-ng>
    </div>
</body>

控制器和指令

/** @jsx React.DOM*/
(function () {
    'use strict';

    var app = angular.module('App');

    var ReceptionReactController = function ($scope){
        $scope.framework = 'test';

    };

    app.controller('ReceptionReactController', ['$scope', ReceptionReactController]).directive('fastNg', function(){
        return {
            restrict: 'E',
            scope: {
                framework: '='
            },
            link: function (scope, el, attrs){
                scope.$watch('framework', function(newValue, oldValue){
                    React.render(
                        MYCOMPONENT({ framework: newValue }),
                        el[0]
                    );
                });
            }
        }
    });

}());

我有 fork plunker http://plnkr.co/edit/UMfKatketZadKVnvlfJV?p=preview

当使用 angular 时,我更喜欢使用 render 并传递我在内部创建的组件,如下所示:-

React.render(React.createElement(
      MYCOMPONENT,{
        framework: newValue
      }),
      el[0]
    );

http://plnkr.co/edit/Aq4zED2DFB9T69KHMcEV?p=preview