From 1f7e4c34f42a8bc19500829571b7d1e3e65e7e59 Mon Sep 17 00:00:00 2001 From: ymanfroy Date: Fri, 31 May 2024 10:16:27 +0200 Subject: [PATCH 1/3] Exercise 1 - Currency --- itenium-socks/src/app/app.component.ts | 12 ++++++++++-- itenium-socks/src/app/socks/shop.component.html | 2 +- itenium-socks/src/app/socks/shop.component.ts | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/itenium-socks/src/app/app.component.ts b/itenium-socks/src/app/app.component.ts index 8ad7283..d440cc3 100644 --- a/itenium-socks/src/app/app.component.ts +++ b/itenium-socks/src/app/app.component.ts @@ -1,5 +1,7 @@ -import { Component } from '@angular/core'; +import {Component, LOCALE_ID} from '@angular/core'; import { RouterOutlet } from '@angular/router'; +import { registerLocaleData } from '@angular/common'; +import localeNlBe from '@angular/common/locales/nl-BE'; @Component({ selector: 'app-root', @@ -7,6 +9,12 @@ import { RouterOutlet } from '@angular/router'; imports: [ RouterOutlet, ], + providers: [{ provide: LOCALE_ID, useValue: 'nl-BE' }], templateUrl: './app.component.html', }) -export class AppComponent {} +export class AppComponent { + + constructor() { + registerLocaleData(localeNlBe, 'nl-BE'); + } +} diff --git a/itenium-socks/src/app/socks/shop.component.html b/itenium-socks/src/app/socks/shop.component.html index a0139e2..2e9e5c8 100644 --- a/itenium-socks/src/app/socks/shop.component.html +++ b/itenium-socks/src/app/socks/shop.component.html @@ -14,7 +14,7 @@

{{ sock.name }}
-
{{ sock.price }}
+
{{ sock.price | currency: 'EUR':'symbol':'1.2-2'}}
diff --git a/itenium-socks/src/app/socks/shop.component.ts b/itenium-socks/src/app/socks/shop.component.ts index 33c897b..ab8ba17 100644 --- a/itenium-socks/src/app/socks/shop.component.ts +++ b/itenium-socks/src/app/socks/shop.component.ts @@ -1,13 +1,13 @@ -import { Component } from '@angular/core'; +import {Component, LOCALE_ID} from '@angular/core'; import { SocksService } from './socks.service'; import { Observable } from 'rxjs'; import { Sock } from './sock.model'; -import { AsyncPipe, NgFor } from '@angular/common'; +import {AsyncPipe, CurrencyPipe, NgFor} from '@angular/common'; @Component({ selector: 'app-shop', standalone: true, - imports: [NgFor, AsyncPipe], + imports: [NgFor, AsyncPipe, CurrencyPipe], templateUrl: './shop.component.html' }) export class ShopComponent { From 727bf8e2d3da59ab10537931e17b49f4b90939ce Mon Sep 17 00:00:00 2001 From: ymanfroy Date: Fri, 31 May 2024 10:54:51 +0200 Subject: [PATCH 2/3] Revert "Exercise 1 - Currency" This reverts commit 1f7e4c34f42a8bc19500829571b7d1e3e65e7e59. --- itenium-socks/src/app/app.component.ts | 12 ++---------- itenium-socks/src/app/socks/shop.component.html | 2 +- itenium-socks/src/app/socks/shop.component.ts | 6 +++--- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/itenium-socks/src/app/app.component.ts b/itenium-socks/src/app/app.component.ts index d440cc3..8ad7283 100644 --- a/itenium-socks/src/app/app.component.ts +++ b/itenium-socks/src/app/app.component.ts @@ -1,7 +1,5 @@ -import {Component, LOCALE_ID} from '@angular/core'; +import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router'; -import { registerLocaleData } from '@angular/common'; -import localeNlBe from '@angular/common/locales/nl-BE'; @Component({ selector: 'app-root', @@ -9,12 +7,6 @@ import localeNlBe from '@angular/common/locales/nl-BE'; imports: [ RouterOutlet, ], - providers: [{ provide: LOCALE_ID, useValue: 'nl-BE' }], templateUrl: './app.component.html', }) -export class AppComponent { - - constructor() { - registerLocaleData(localeNlBe, 'nl-BE'); - } -} +export class AppComponent {} diff --git a/itenium-socks/src/app/socks/shop.component.html b/itenium-socks/src/app/socks/shop.component.html index 2e9e5c8..a0139e2 100644 --- a/itenium-socks/src/app/socks/shop.component.html +++ b/itenium-socks/src/app/socks/shop.component.html @@ -14,7 +14,7 @@

{{ sock.name }}
-
{{ sock.price | currency: 'EUR':'symbol':'1.2-2'}}
+
{{ sock.price }}
diff --git a/itenium-socks/src/app/socks/shop.component.ts b/itenium-socks/src/app/socks/shop.component.ts index ab8ba17..33c897b 100644 --- a/itenium-socks/src/app/socks/shop.component.ts +++ b/itenium-socks/src/app/socks/shop.component.ts @@ -1,13 +1,13 @@ -import {Component, LOCALE_ID} from '@angular/core'; +import { Component } from '@angular/core'; import { SocksService } from './socks.service'; import { Observable } from 'rxjs'; import { Sock } from './sock.model'; -import {AsyncPipe, CurrencyPipe, NgFor} from '@angular/common'; +import { AsyncPipe, NgFor } from '@angular/common'; @Component({ selector: 'app-shop', standalone: true, - imports: [NgFor, AsyncPipe, CurrencyPipe], + imports: [NgFor, AsyncPipe], templateUrl: './shop.component.html' }) export class ShopComponent { From bf4835f93b8fd8d470cd802de73f6d85fca0a8ae Mon Sep 17 00:00:00 2001 From: ymanfroy Date: Fri, 31 May 2024 14:48:16 +0200 Subject: [PATCH 3/3] Templates - document title --- itenium-socks/src/app/app.routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itenium-socks/src/app/app.routes.ts b/itenium-socks/src/app/app.routes.ts index 14b59f8..141c21c 100644 --- a/itenium-socks/src/app/app.routes.ts +++ b/itenium-socks/src/app/app.routes.ts @@ -12,7 +12,7 @@ export const routes: Routes = [ path: '', component: LayoutComponent, children: [ - { path: 'why-us', component: WhyUsComponent }, + { path: 'why-us', component: WhyUsComponent, title: 'Why Us | Toe-tally Amazing' }, { path: 'socks', component: ShopComponent }, { path: 'socks/:id', component: SockComponent }, ]