AngularJS app inside ReactJS component? -
is possible create angular app inside react component?
something like:
react.createclass({ render: function() { return <div ng-app>...</div>; } });
this backwards, have temporary solution. i'm assuming code above, , add angular bootstrapping componentdidmount
lifecycle method.
has done this?
thanks.
it this:
componentdidmount: function(){ this._angularel = document.createelement("div"); this._angularel.innerhtml = angulartemplathtmlstring; this._angularel.setattribute("ng-app", ""); this.getdomnode().appendchild(this._angularel); // bind angular this._angularel }, componentwillunmount: function(){ // unbind angular this._angularel this.getdomnode().removechild(this._angularel); delete this._angularel; }, render: function(){ return <div></div> }
you either use each component, or create function returns mixin.
function makeangularmixin(template){ return { /* above code except render */ } }
or have component allows passing angular template via props.
Comments
Post a Comment