Skip to content
Advertisement

Tag: web-component

child elements usage in shadow dom

Is there any constraint that’s preventing <thead>, <tbody>, <tr> and so on to be slotted in shadow DOM? Given the following example: renders into the following structure: The workaround would be to use templates and insert template content with JS in slotchange event handler, but I would like to avoid that since the cloned content would end up in shadow

When should I use componentDidMount?

In React componentDidMount is used during the mounting phase, for example, one can setState and wrap it in componentDidMount. But, one can use setState directly and then render the component. In which cases should I prefer componentDidMount for a mounting phase? Answer It’s useful for several things: Starting ajax As the documentation says, doing subscriptions to things (for instance, if

How can I share an Angular 2 component between multiple Angular 2 projects?

Ideally, I’d like to create a stand-alone Angular 2 component (with tests) and then re-use it between two or three different Angular 2 sites. What are the good ways to achieve this? And a bonus question – do any 3rd party Angular 2 components exist? Answer UPDATE OFFICIAL Angular CLI https://angular.io/guide/creating-libraries You can create an angular2 component library (with tests)

Advertisement