Skip to content

Instantly share code, notes, and snippets.

@kavicastelo
Last active April 23, 2025 15:44
Show Gist options
  • Select an option

  • Save kavicastelo/291fa9730e214da06059efb512655fc5 to your computer and use it in GitHub Desktop.

Select an option

Save kavicastelo/291fa9730e214da06059efb512655fc5 to your computer and use it in GitHub Desktop.
Angular Learning Module 1 (Interns) - Basics + Standalone Components
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProjectsComponent } from './projects/projects.component';
import { AboutComponent } from './about/about.component';
export const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'projects', component: ProjectsComponent },
{ path: 'about', component: AboutComponent },
{ path: '**', redirectTo: 'home' }
];
<div class="card">
<h2>{{ name }}</h2>
<p>{{ title }}</p>
</div>
import { Component, Input } from '@angular/core';
@Component({
standalone: true,
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.css']
})
export class CardComponent {
@Input() name = '';
@Input() title = '';
}
<h1>Welcome to My Angular App</h1>
<app-card [name]="name" [title]="title"></app-card>
import { Component } from '@angular/core';
@Component({
standalone: true,
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent {
name = 'John Doe';
title = 'Aspiring Developer';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment