---
title: "Routing transfer to placeholders in the JSS Angular sample app"
slug: "routing-transfer-to-placeholders-in-the-jss-angular-sample-app"
abstract: "Describes how the root placeholder handles rendering route data from the router"
---
# Routing transfer to placeholders in the JSS Angular sample app

[Placeholders](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-headless-development/introducing-placeholders-in-jss-apps.html "Introducing placeholders in JSS apps") are vital components in any application built with Sitecore JSS. To provide examples, this topic uses the Sitecore JSS Angular sample application.

The JSS Angular sample application comes with a root placeholder. The root placeholder is defined in `src/app/routing/layout/layout.component.html`.

The `sc-placeholder` component is imported from Sitecore JSS for Angular, `@sitecore-jss/sitecore-jss-angular`.

```text
<sc-placeholder name="jss-main" [rendering]="route" (loaded)="onPlaceholderLoaded($event)"></sc-placeholder><sc-placeholder name="jss-main" [rendering]="route"></sc-placeholder>

```

This root placeholder handles rendering route data from the router.

The Angular `sc-placeholder` component has a `name` attribute with the value `jss-main`, indicating that it represents the Sitecore placeholder named `jss-main`. The placeholder renders one or more components based on route data, as indicated by the data bound to the `[rendering]` input of the placeholder component:

```text
[rendering]="route"

```

You can trace where route data comes from and see in the `src/app/routing/layout/layout.component.ts` file that you get a route reference injected:

```csharp
export class LayoutComponent implements OnInit, OnDestroy {
  route: RouteData;
  state: LayoutState;
  LayoutState = LayoutState;
  subscription: Subscription;
  errorContextData: LayoutServiceContextData;

  constructor(
    private activatedRoute: ActivatedRoute,
    private readonly meta: MetaService,
  ) { }
...
}

```

This route reference contains the `data` observable that you can subscribe to and receive current route data during route changes:

```csharp
route: RouteData;

ngOnInit() {
  this.subscription = this.activatedRoute.data.subscribe((data: { jssState: JssState }) => {
    this.route = data.jssState.sitecore.route;
  }
}

```

Because it has access to the placeholder object within the route property, the `sc-placeholder` component handles finding the matching placeholder by name and rendering the array of components defined for the placeholder in the route data. The following is an example of a component implementation. The `sc-placeholder` sets the rendering input automatically:

```csharp
import { Component, Input } from '@angular/core';
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';

@Component({
  selector: 'app-welcome',
  templateUrl: './welcome.component.html',
})
export class WelcomeComponent {
  @Input() rendering: ComponentRendering;
}

```

The rendering property includes all the information available to the component, including data fields:

```csharp
{
  componentName: 'Welcome',
  fields: {
    title: {
      value: 'Sitecore Experience Platform + JSS',
    },
    text: {
      value: '<p>...</p>',
    },
    logoImage: {
      value: {
        src: '/sitecore/assets/sc_logo.png',
        alt: 'Logo'
      },
    },
  }
}

```