Created
October 7, 2015 16:36
-
-
Save jasonish/16a9d48ca65440546eb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import angular from 'angular'; | |
| import React from "react"; | |
| function DownloadProgressBar() { | |
| return { | |
| restrict: "AE", | |
| scope: { | |
| }, | |
| link: function(scope, element) { | |
| class SomeBox extends React.Component { | |
| componentDidMount() { | |
| console.log("SomeBox.componentDidMount"); | |
| } | |
| componentWillUnmount() { | |
| console.log("SomeBox.componentWillUnmount"); | |
| } | |
| render() { | |
| return <div>I was rendered from react.</div>; | |
| } | |
| } | |
| let target = element.get(0); | |
| React.render( | |
| <SomeBox/>, | |
| target | |
| ); | |
| scope.$on("$destroy", () => { | |
| React.unmountComponentAtNode(target); | |
| }); | |
| } | |
| } | |
| } | |
| export default angular.module("app.downloadProgressBar", []) | |
| .directive("downloadProgressBar", DownloadProgressBar) | |
| .name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment