Generate standalone component using CLI command as shown below
ng generate component component-name --standalone
On running the command standalone component is created. Here is the list of file created.
component-name.component.ts
component-name.component.css
component-name.component.spec
component-name.component.html
Next need to update app.module.ts
as shown below.
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ComponentNameComponent } from './component-name/component-name.component';
@NgModule({
imports: [
BrowserModule,
ComponentNameComponent
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}