Skip to main content
Our docs redesign is live!
angular.svg

Kickstart Angular

5 min read

If you want a Contentstack example in Angular with as little ceremony as possible, this kickstart gives you a clear starting point.

It is also worth noting that the repository currently describes itself as a work in progress. That makes this page especially useful as a repo-based guide: the code is already helpful, but the best way to understand it is by looking at how the current implementation is shaped.

This page is a practical developer guide based on the repository itself, not a replacement for official docs. The goal is to explain what is already there and how you can think about it as a starter pattern.

What a kickstart is

A kickstart is the smallest useful project that connects a frontend framework to Contentstack. It is meant to solve the repetitive setup pieces first, so you can study the integration itself:

  • SDK setup
  • content fetching
  • preview configuration
  • editable field bindings for Visual Builder

That is exactly what makes the Angular kickstart useful. You are not starting from a blank Angular app and inventing the entire Contentstack integration yourself.

Why start with the Angular kickstart

This kickstart is a good fit when you want to:

  • see what Contentstack looks like in a modern Angular app
  • learn the integration through an Angular service and routed component structure
  • keep preview updates client-driven and easy to follow
  • start from a small example before introducing more Angular architecture

It is especially helpful if your team thinks naturally in terms of services, standalone components, and routing.

What you get out of the box

The current contentstack/kickstart-angular repository includes:

  • Angular 21
  • standalone components and router setup
  • a dedicated ContentstackService
  • Live Preview support
  • Visual Builder editable field bindings
  • generated Angular environment files based on a local .env
  • a seeded page content type with a sample homepage

That environment generation step is one of the most distinctive parts of this repo, so it is worth understanding early.

How this specific kickstart works

1. generate-env.js turns .env values into Angular environment files

Unlike some of the other kickstarts, this repo does not read the Contentstack values directly from a frontend runtime config object.

Instead, the prestart and prebuild scripts run generate-env.js, which reads the .env file and writes:

  • src/environments/environment.ts
  • src/environments/environment.production.ts

That gives Angular a framework-native place to read the final Contentstack configuration from.

2. src/app/services/contentstack.service.ts owns the integration

This service is the real center of the project.

It:

  • creates the Contentstack Delivery SDK stack
  • initializes Live Preview with ssr: false
  • maps the right delivery and preview hosts
  • exposes getEntryByUrl(contentType, url) as an observable
  • adds editable tags in preview mode before returning the entry

If you want the quickest understanding of the repo, read this file first.

3. src/app/components/home/home.component.ts keeps the page logic small

The home component injects the service, stores the current page in Angular signals, and defines a getContent() method that loads the homepage entry.

On init, it subscribes to ContentstackLivePreview.onEntryChange(...) and calls getContent() again when content changes.

That means the preview loop is very similar to the client-refresh style you have already seen in React and the base Next/Nuxt examples.

4. home.component.html shows the editable binding pattern clearly

The Angular template renders the familiar content model:

  • title
  • description
  • hero image
  • rich text
  • modular blocks

What is especially useful here is how explicit the editable bindings are. You can see the data-cslp attributes being applied through Angular template bindings, which makes the Visual Builder integration easy to reason about.

The important preview nuance

This kickstart initializes Live Preview with ssr: false.

That means preview updates happen through a client-side change flow:

  • Contentstack sends a change event
  • the Angular app receives it
  • the home component fetches the content again
  • the UI updates without a full page reload

That makes the Angular kickstart a good fit when you want the preview loop to stay simple and visible in the component logic.

What you are really learning from this project

This repo teaches a few useful Angular-shaped patterns:

  • how to put Contentstack logic inside a service
  • how to use observables and signals for page content
  • how to keep Angular environment handling separate from the UI
  • how to bind editable tags explicitly in a template

That makes it a practical reference even if the repo is still evolving.

When to choose this one

Choose the Angular kickstart when:

  • you want the clearest Angular-specific Contentstack example
  • you prefer a service-driven integration layer
  • you want preview updates to happen in place through a client callback
  • you are comfortable with build-time generation of Angular environment files

If you are looking for a more request-aware SSR preview pattern, Astro or SvelteKit are closer to that style in this set.

Fastest way to try it

The shortest path is:

  1. Clone the repo.
  2. Seed or reuse the kickstart stack.
  3. Create a delivery token with preview enabled.
  4. Copy .env.example to .env and fill in the Contentstack values.
  5. Enable Live Preview for the same environment.
  6. Run npm install.
  7. Run npm run start.

One detail worth remembering: the repo expects the local preview URL to be http://localhost:4200/, so that is the URL to use in the Contentstack environment settings.

A good next step after the first run

After the homepage works, the best next move is adding another routed component and reusing the same service pattern. That keeps the repo’s strongest idea intact: Contentstack integration lives in one Angular service, while components stay focused on rendering.