stackblitz / stackblitz/starters

New Angular starter is not beginner friendly

Open
#5 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
151
Forks
96
Avg merge
9d 6h
Merged PRs (30d)
2

Description

The new Angular starter seems to have removed the default AppComponent that all new Angular projects, generated by Angular CLI, are setup with. There's no app folder, instead the usual contents of the AppComponent are now somehow in main.ts -

import 'zone.js/dist/zone';
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { bootstrapApplication } from '@angular/platform-browser';
import { FirstComponent } from './first/first.component';

@Component({
  selector: 'my-app',
  standalone: true,
  imports: [CommonModule, FirstComponent], // ERROR - cannot import custom components
  template: `
    <h1>Hello from {{name}}!</h1>
    <a target="_blank" href="https://angular.io/start">
      Learn more about Angular 
    </a>
    <app-first></app-first>
  `,
})
export class App {
  name = 'Angular';
}

bootstrapApplication(App);

Creating new, custom components and importing them into an AppComponent (which is what everyone does when getting started with Angular) now no longer works -

Screenshot 2023-06-17 at 9 09 25 PM

URL - https://stackblitz.com/edit/stackblitz-starters-2hwyyr?file=src%2Fmain.ts

It is not convenient having users go and first learn how to deal with standalone components and NgModule, if all they want to do is get started with a simple Angular app quickly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening the linked starter and inspecting src/main.ts, then compare its structure with a new Angular CLI project. Reproduce the custom-component import error shown in the issue. Done means the starter offers the expected beginner-friendly AppComponent structure and a newly created component can be imported and rendered successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.