Last active
April 23, 2025 15:44
-
-
Save kavicastelo/291fa9730e214da06059efb512655fc5 to your computer and use it in GitHub Desktop.
Angular Learning Module 1 (Interns) - Basics + Standalone Components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' } | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="card"> | |
| <h2>{{ name }}</h2> | |
| <p>{{ title }}</p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 = ''; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Welcome to My Angular App</h1> | |
| <app-card [name]="name" [title]="title"></app-card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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