How to Create an Online Course and Community with Angular

Step-by-step guide to launch your online course and community inside an Angular app using Embedin.

How to Create an Online Course and Community with Angular
Diego Oliveira

Diego Oliveira

Aug 10, 2024

How to Create an Online Course and Community with Angular

Angular is a great choice when you want a structured frontend architecture for your learning product.

With Embedin, you can keep Angular focused on UI and product flows while Embedin handles course delivery and community features.

What you will build

Step 1: Create your course in Embedin

  1. Create your course, modules, and lessons in Embedin.
  2. Publish the initial version.
  3. Copy your course ID.

You can find the course ID in course settings in Embedin.

Step 2: Allow your Angular domain

In Embedin course settings, allow the domains where your app runs:

Step 3: Embed Embedin in Angular

Create a course component and load the Embedin script once.

import { Component, OnDestroy, OnInit } from '@angular/core'

@Component({
  selector: 'app-course',
  template: `
    <main>
      <h1>Academy</h1>
      <div [id]="courseId" [attr.data-courseid]="courseId"></div>
    </main>
  `,
})
export class CourseComponent implements OnInit, OnDestroy {
  courseId = 'YOUR_COURSE_ID'
  private scriptEl?: HTMLScriptElement

  ngOnInit() {
    this.scriptEl = document.createElement('script')
    this.scriptEl.type = 'module'
    this.scriptEl.src = 'https://embed.embedin.com/course.js'
    this.scriptEl.setAttribute('data-courseid', this.courseId)
    document.body.appendChild(this.scriptEl)
  }

  ngOnDestroy() {
    if (this.scriptEl) {
      document.body.removeChild(this.scriptEl)
    }
  }
}

Replace YOUR_COURSE_ID with your real ID from course settings.

Step 4: Enable Community

Turn on Community in course settings. Your learners can then:

Step 5: Launch with starter threads

Start with three posts:

Final thought

Angular gives you a robust app structure, and Embedin gives you the course and community engine. Together, you can launch a full learning experience fast.

Latest posts

© Embedin. All rights reserved.