Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Angular starter is not beginner friendly #5

Open
Manish-Giri opened this issue Jun 18, 2023 · 0 comments
Open

New Angular starter is not beginner friendly #5

Manish-Giri opened this issue Jun 18, 2023 · 0 comments

Comments

@Manish-Giri
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant