-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for children transclude #36
Conversation
b45e84e
to
42bc4dc
Compare
So @bcherny I managed to fix the escaping issue by using |
42bc4dc
to
11c78c9
Compare
@spirosikmd This is excellent, thanks for that hard work! A couple of notes:
|
Hi @bcherny! Thank you for providing the package in the first place! The sizes for
compared to
Size of |
@spirosikmd 0.6kb is no big deal, but what happens when you run that through browserify (to pull in htmltojsx, html-react-parser, and all of their dependencies)? |
When running the following command
on both branches, the |
I was worried it would be more in the 10-20mb range. 2.5mb is fine I think. A tree-shaking compiler (rollup, webpack) will improve that size, and we get a lot of functionality for that extra 1.4mb. |
Cool ok then! I will work on adding some tests and docs for this feature. |
67a0ce1
to
506ab0e
Compare
$compile(element)(scope) | ||
$rootScope.$apply() | ||
expect(element.find('span').text()).toBe('1') | ||
// scope.$apply(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcherny we can now transclude other components as well, and bind once with initial rendering. However, I cannot manage to update the two way binding. Any idea? Would it be possible to release without this support for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spirosikmd This looks like a pretty serious bug to me. In your test it's not that the view doesn't update, it's that it reverts to its original untemplated version (eg. in this case it's {'{'}{'{'}foo{'}'}{'}'}
. If that's correct, I would argue this should be fixed before we merge. Broken support for transclusion (that sets false expectations) could be worse than no support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are definitely right. This should be fixed first!
506ab0e
to
fe7be8a
Compare
@spirosikmd Any updates on this? |
Hey @bcherny! I haven't worked on this yet. I am trying the approach described in this article, passing all the data needed as props and don't use transclusion. |
@spirosikmd Sounds good! I was doing some PR cleanup and wanted to make sure this wasn't forgotten. |
Any update? |
Any update? |
Fixes #12
@bcherny I followed the recommendations mentioned in the issue. I created a prototype. Seems that it is possible. However, the last part I am not sure how to proceed best. Current status is:
the transcluded components are added as children, but they are escaped. Any idea? Maybe use angular $sce?