WIP
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/iisa-web",
|
||||
"outputPath": "./dist/iisa_web",
|
||||
"index": "src/index.html",
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": [
|
||||
|
||||
@@ -333,4 +333,15 @@
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
|
||||
|
||||
<button (click)="this.sendRequest()">Send request</button>
|
||||
@if(this.error){
|
||||
<p>response:</p>
|
||||
<p>{{ this.error }}</p>
|
||||
}
|
||||
@if (this.response) {
|
||||
<p>response:</p>
|
||||
<p>{{ this.response }}</p>
|
||||
}
|
||||
|
||||
|
||||
<router-outlet />
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AppComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have the 'IISA_web' title`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('IISA_web');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, IISA_web');
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
@@ -9,4 +10,14 @@ import { RouterOutlet } from '@angular/router';
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'IISA_web';
|
||||
httpClient = inject(HttpClient);
|
||||
response: any | null = null;
|
||||
error: any | null = null;
|
||||
|
||||
sendRequest(){
|
||||
this.httpClient.get('http://localhost:3000/app/candidates').subscribe({
|
||||
next: (res) => this.response = JSON.stringify(res),
|
||||
error: err => this.error = JSON.stringify(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
|
||||
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideHttpClient()]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user