Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1005 Bytes

standalone.md

File metadata and controls

59 lines (46 loc) · 1005 Bytes

Angular Standalone

Installation

# Generate the image component
ng generate component image

Image Component Source Code

<!-- image.component.html -->
<p>image works!</p>
// image.component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'app-image',
  standalone: true,
  imports: [],
  templateUrl: './image.component.html',
  styleUrl: './image.component.css'
})
export class ImageComponent {

}

App Component Source Code

<!-- app.component.html -->
<app-image></app-image>
// app.component.ts
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { ImageComponent } from './image/image.component';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet, ImageComponent],
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'angular-starter';
}