This is a bit of a sanity check question. At a high level we're working on putting together a small POC for testing how we can integrate a few Angular 2 components into a CMS driven page.
The bulk of the page content will come from the CMS but with a few locations in the template for hooking in the Angular component selectors and rendering the components. This basic task is working without much trouble, we have a couple of components that currently stand alone and bootstrap into the selectors provided in the template and render. Where we've hit a snag is how we can build components that need to share some context/data, or service singletons but don't necessarily live in the same region of the page. Meaning there would be some amount of CMS controlled content separating the components that would be out of Angulars scope of control. In Angular 1 we were able to accomplish this by having a top-level controller on the same element as our ng-app declaration that provided the shared context and data. The individual components could then be dropped in wherever in the page template and they'd have access to the data while the CMS could also populate regions in the template without issues. So far I've failed to find a way to do this in Angular2. Trying a top level component results in any content populated from the CMS is being wiped out and replaced by just what is defined in the components template once the component loads. Makes sense, but I've failed to find a way that would allow us to pull in the CMS populated content from the initially rendered page and integrate it into the components template. My understanding and experience seem to show that <ng-content> doesn't appear to work at this level so we can't seem to grab the initial content of the component tag and re-render it as part of the components template. I'm starting to run out of ideas for how we could approach this and figured I'd bounce this question out and see if anyone had experience or suggestions on ways we may be able to accomplish this. I feel like there's got to be a more appropriate way to go about this. Any thoughts would be greatly appreciated! -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
