Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions .github/workflows/website-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Website Linter check

on:
pull_request:
paths:
- 'apps/website/**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install Dependencies
working-directory: ./apps/website
run: npm ci

- name: Run ESLint
working-directory: ./apps/website
run: npm run lint
4 changes: 4 additions & 0 deletions apps/website/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export const routes: Routes = [
'./domains/products/pages/product-detail/product-detail.component'
),
},
{
path: 'locations',
loadComponent: () => import('./domains/locations/locations.component'),
},
],
},
{
Expand Down
Empty file.
10 changes: 9 additions & 1 deletion apps/website/src/app/domains/locations/locations.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
<p>locations works!</p>
<ul>
@for (location of locations; track location.id) {
<li>
<a>
{{ location.name }}
</a>
</li>
}
</ul>
30 changes: 27 additions & 3 deletions apps/website/src/app/domains/locations/locations.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';

interface Location {
id: number;
name: string;
description: string;
latitude: number;
longitude: number;
}

@Component({
selector: 'app-locations',
imports: [],
templateUrl: './locations.component.html',
styleUrl: './locations.component.css',
})
export default class LocationsComponent {}
export default class LocationsComponent implements OnInit {
locations: Location[] = [];

constructor(private http: HttpClient) {}

ngOnInit() {
this.http
.get<Location[]>('https://api.escuelajs.co/api/v1/locations')
.subscribe(data => {
this.locations = data;
});
}

get name() {
return this.locations.map(location => location.name).join(', ');
}
}