Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8c2fbea
Add User component and conditional rendering in AppComponent
NathanPython2002 Aug 7, 2025
9a7a86d
Add server status conditional display
NathanPython2002 Aug 18, 2025
481d16c
feat: add user list
NathanPython2002 Aug 18, 2025
21a5049
add isEditable property with contentEditable binding
NathanPython2002 Aug 18, 2025
ecb42e7
add mouseover event handler to section
NathanPython2002 Aug 18, 2025
e20cb58
add input property 'name' to User component
NathanPython2002 Aug 18, 2025
8c7c6bc
add child output event and handle item addition
NathanPython2002 Aug 19, 2025
6578b40
Add Comments component with defer loading
NathanPython2002 Aug 19, 2025
67b634a
Optimize images with ngOptimizedImage directive
NathanPython2002 Aug 19, 2025
8cf4908
setup Angular Router with RouterOutlet in AppComponent
NathanPython2002 Aug 19, 2025
a50c02a
Separate page-specific content into home and user
NathanPython2002 Aug 19, 2025
c8e1949
Use Routerlink directive for navigation
NathanPython2002 Aug 19, 2025
4763bc0
Add FavoriteFramework input with NgModel
NathanPython2002 Aug 19, 2025
01489da
Add functionality to retrieve and display form input value
NathanPython2002 Aug 21, 2025
5839e81
Add reactive form for name and email with submit handling
NathanPython2002 Aug 21, 2025
ee99674
add reactive form validation for name and email
NathanPython2002 Aug 21, 2025
053e516
add CarService and display cars in AppComponent
NathanPython2002 Aug 21, 2025
a611576
inject CarService into AppComponent and display cars
NathanPython2002 Aug 21, 2025
12e19a0
add LowerCasePipe to AppComponent and display username in lowercase
NathanPython2002 Aug 21, 2025
62c943e
add pipes for data formatting (lowercase, decimal, date, currency)
NathanPython2002 Aug 21, 2025
6fa0a8b
add custom ReversePipe and integrate it in AppComponent
NathanPython2002 Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
"outputPath": "dist/rero-angular",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/assets",
"src/favicon.ico",
{
"glob": "**/*",
"input": "public"
"input": "public",
"output": "/"
}
],
"styles": [
"src/styles.css"
],

"styles": ["src/styles.css"],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -73,20 +73,15 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"styles": ["src/styles.css"],
"scripts": []
}
}
Expand Down
Empty file removed src/app/app.component.css
Empty file.
336 changes: 0 additions & 336 deletions src/app/app.component.html

This file was deleted.

29 changes: 0 additions & 29 deletions src/app/app.component.spec.ts

This file was deleted.

66 changes: 60 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,66 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Component, inject } from '@angular/core';
import {
NgOptimizedImage,
LowerCasePipe,
DecimalPipe,
DatePipe,
CurrencyPipe,
} from '@angular/common';
import { RouterLink, RouterOutlet } from '@angular/router';
import { CarService } from './car.service';
import { ReversePipe } from './reverse.pipe';

@Component({
selector: 'app-root',
imports: [RouterOutlet],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
standalone: true,
imports: [
NgOptimizedImage, // For optimized image loading
RouterOutlet, // For routing
RouterLink, // For router links
LowerCasePipe, // For lowercasing text
DecimalPipe, // For formatting numbers
DatePipe, // For formatting dates
CurrencyPipe, // For formatting currency
ReversePipe, // Custom reverse pipe
],
template: `
<nav>
<a routerLink="/">Home</a> |
<a routerLink="/user">User</a>
</nav>

<router-outlet></router-outlet>

<p>Car Listing: {{ display }}</p>
<p>Username lowercased: {{ username | lowercase }}</p>
<p>Reverse Machine: {{ word | reverse }}</p>

<h2>Pipes formatting demo</h2>
<ul>
<li>Number with "decimal": {{ num | number : '3.2-2' }}</li>
<li>Date with "date": {{ birthday | date : 'medium' }}</li>
<li>Currency with "currency": {{ cost | currency }}</li>
</ul>

<img ngSrc="assets/logo.svg" alt="Angular logo" width="32" height="32" />
`,
styles: [
`
:host {
color: #a144eb;
}
`,
],
})
export class AppComponent {
title = 'Rero-Angular';
carService = inject(CarService);
display = this.carService.getCars().join(' ⭐️ ');

username = 'NathanPython2002';
word = 'AngularRocks';

// Example data for pipes
num = 7.234;
birthday = new Date(1995, 6, 15);
cost = 1234.56;
}
8 changes: 0 additions & 8 deletions src/app/app.config.ts

This file was deleted.

11 changes: 11 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { routes } from './app.routes';
import { RouterModule } from '@angular/router';

@NgModule({
imports: [BrowserModule, AppComponent, RouterModule.forRoot(routes)],
bootstrap: [AppComponent],
})
export class AppModule {}
7 changes: 6 additions & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { Routes } from '@angular/router';
import { Home } from './home/home.component';
import { User } from './user/user.component';

export const routes: Routes = [];
export const routes: Routes = [
{ path: '', title: 'App Home Page', component: Home },
{ path: 'user', title: 'App User Page', component: User },
];
16 changes: 16 additions & 0 deletions src/app/car.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root', // makes this service available application-wide
})
export class CarService {
cars = ['Sunflower GT', 'Flexus Sport', 'Sprout Mach One'];

getCars(): string[] {
return this.cars;
}

getCar(id: number) {
return this.cars[id];
}
}
15 changes: 15 additions & 0 deletions src/app/child.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, output } from '@angular/core';

@Component({
selector: 'app-child',
standalone: true,
template: ` <button (click)="addItem()">Add Item</button> `,
})
export class Child {
// 👉 Output property (type string)
addItemEvent = output<string>();

addItem() {
this.addItemEvent.emit('🐢');
}
}
8 changes: 8 additions & 0 deletions src/app/comments.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-comments',
template: ` <p>Here are some comments...</p> `,
standalone: true,
})
export class Comments {}
8 changes: 8 additions & 0 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-home',
standalone: true,
template: `<h1>Welcome to the home page !</h1>`,
})
export class Home {}
15 changes: 15 additions & 0 deletions src/app/reverse.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'reverse',
standalone: true,
})
export class ReversePipe implements PipeTransform {
transform(value: string): string {
let reverse = '';
for (let i = value.length - 1; i >= 0; i--) {
reverse += value[i];
}
return reverse;
}
}
Loading