Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
title/spa-angular-minimal/browse/src/app/root.component.ts
  constructor(private http: HttpClient, private router: Router, private rendererContext: RendererContextService) {
    this.rendererContext.setComponentMapping({
      'angular-magnolia-int:pages/home': HomeComponent,
      'angular-magnolia-int:pages/about': AboutComponent,
      'angular-magnolia-int:components/title': TitleComponent,
      'angular-magnolia-int:components/componentWithArea': ComponentWithAreaComponent,
      'angular-magnolia-int:components/navigation': NavigationComponent,
    });

    // refresh the content on navigation event
    this.router.events.subscribe((event) => {
      if (event instanceof NavigationEnd) {
        this.getContent(event.url);
      }
    }

Mapping between Magnolia and ReactJS

...

Code Block
title/magnolia-react-tutorial/browse/src/environments/mapping.js
const COMPONENTS = {
    'sample-light-module:components/title': Title,
    'sample-light-module:components/text-image': TextImage,
    'sample-light-module:components/nested': Nested,
    'sample-light-module:components/navigation': Navigation
};

export default COMPONENTS;