code: function($injector) {
      return {
        restrict: 'E',
        replace: true,
        link: function(scope, elem, attrs) {
          var reactComponent = getReactComponent(attrs.name, $injector);
  
          var renderMyComponent = function() {
            var scopeProps = scope.$eval(attrs.props);
            var props = applyFunctions(scopeProps, scope);
  
            renderComponent(reactComponent, props, scope, elem);
          };
  
          // If there are props, re-render when they change
          attrs.props ?
            watchProps(attrs.watchDepth, scope, [attrs.props], renderMyComponent) :
            renderMyComponent();
  
          // cleanup when scope is destroyed
          scope.$on('$destroy', function() {
            if (!attrs.onScopeDestroy) {
              ReactDOM.unmountComponentAtNode(elem[0]);
            } else {
              scope.$eval(attrs.onScopeDestroy, {
                unmountComponent: ReactDOM.unmountComponentAtNode.bind(this, elem[0])
              });
            }
          });
        }
      };
    }
docs: # reactComponent Directive that allows React components to be used in Angular templates.  Usage: <react-component name="Hello" props="name"/>  This requires that there exists an injectable or globally available 'Hello' React component. The 'props' attribute is optional and is passed to the component.  The following would would create and register the component:  var module = angular.module('ace.react.components'); module.value('Hello', React.createClass({ render: function() { return <div>Hello {this.props.name}</div>; } }));