react2angular icon indicating copy to clipboard operation
react2angular copied to clipboard

Add support for children/transclusion

Open bcherny opened this issue 7 years ago • 6 comments

See https://github.com/coatue-oss/react2angular/issues/11:

  1. Mark the component as transclude: true
  2. Compile transcluded children in the component's scope
  3. Convert the compiled elements to JSX, and pass them to the component as children

For step 2, the $transclude service could be a good way to go.

Step 3 is where things get hairy. Ideally we would pass the DOM provided by $transclude through something like htmltojsx and into the React component. Alternatively we could pass in transcluded DOM via this.props or this.context, and make rendering it the consumer's responsibility.

bcherny avatar Apr 04 '17 00:04 bcherny

Is there a possibility of this getting merged in?

Sawtaytoes avatar Dec 02 '17 01:12 Sawtaytoes

Pinging @spirosikmd ^

bcherny avatar Dec 03 '17 19:12 bcherny

I don't have the time now to work on this. There is still the issue left with updating transcluding children after the scope is updated. Couldn't figure out a way to accomplish this.

spirosikmd avatar Dec 04 '17 08:12 spirosikmd

Is there any support for having transclusion with AngularJS components? I have a sidebar-wrapper that contains 2 components, one of which (<ui-view/>) isn't something I can re-write as a react-component.

<sidebar-wrapper>
    <project-branch-breadcrumb></project-branch-breadcrumb>
    <ui-view></ui-view>
</sidebar-wrapper>

I re-wrote project-branch-breadcrumb as a react component wrapped in an angular component using react-2-angular but I am not exactly sure how to do that for ui-view since it's a core angular element.

I'm getting this error angular.js:14328 Invariant Violation: Target container is not a DOM element.. Any advice on how to proceed? I can't really NOT use this sidebar-wrapper as it's a core part of our UI.

coreysnyder avatar Jun 25 '18 19:06 coreysnyder

Is there any support for having transclusion with AngularJS components? I have a sidebar-wrapper that contains 2 components, one of which (<ui-view/>) isn't something I can re-write as a react-component.

<sidebar-wrapper>
    <project-branch-breadcrumb></project-branch-breadcrumb>
    <ui-view></ui-view>
</sidebar-wrapper>

I re-wrote project-branch-breadcrumb as a react component wrapped in an angular component using react-2-angular but I am not exactly sure how to do that for ui-view since it's a core angular element.

I'm getting this error angular.js:14328 Invariant Violation: Target container is not a DOM element.. Any advice on how to proceed? I can't really NOT use this sidebar-wrapper as it's a core part of our UI.

I'm also hoping to do something like this

tgfischer avatar Oct 11 '19 14:10 tgfischer

Is there any support for having transclusion with AngularJS components? I have a sidebar-wrapper that contains 2 components, one of which (<ui-view/>) isn't something I can re-write as a react-component.

<sidebar-wrapper>
    <project-branch-breadcrumb></project-branch-breadcrumb>
    <ui-view></ui-view>
</sidebar-wrapper>

I re-wrote project-branch-breadcrumb as a react component wrapped in an angular component using react-2-angular but I am not exactly sure how to do that for ui-view since it's a core angular element.

I'm getting this error angular.js:14328 Invariant Violation: Target container is not a DOM element.. Any advice on how to proceed? I can't really NOT use this sidebar-wrapper as it's a core part of our UI.

for ui-view look at ui-router/react-hybrid

chiptus avatar Oct 28 '21 13:10 chiptus