Skip to content

Instantly share code, notes, and snippets.

@jasonish
Created October 7, 2015 16:36
Show Gist options
  • Select an option

  • Save jasonish/16a9d48ca65440546eb7 to your computer and use it in GitHub Desktop.

Select an option

Save jasonish/16a9d48ca65440546eb7 to your computer and use it in GitHub Desktop.
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