-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from devdanielsun/developer
Update Angular style and bootstrap
- Loading branch information
Showing
30 changed files
with
415 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,5 @@ | ||
<h1 id="tableLabel">Weather forecast</h1> | ||
<app-header></app-header> | ||
|
||
<p>This component demonstrates fetching data from the server.</p> | ||
<router-outlet></router-outlet> | ||
|
||
<p *ngIf="baseApiUrl">App version = {{ appVersion }}</p> | ||
|
||
<p *ngIf="baseApiUrl">The api url = {{ baseApiUrl }}</p> | ||
|
||
|
||
<p *ngIf="!forecasts"><em>Loading... Please refresh once the ASP.NET backend has started. See <a href="https://aka.ms/jspsintegrationangular">https://aka.ms/jspsintegrationangular</a> for more details.</em></p> | ||
|
||
<table *ngIf="forecasts"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Temp. (C)</th> | ||
<th>Temp. (F)</th> | ||
<th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let forecast of forecasts"> | ||
<td>{{ forecast.date }}</td> | ||
<td>{{ forecast.temperatureC }}</td> | ||
<td>{{ forecast.temperatureF }}</td> | ||
<td>{{ forecast.summary }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<app-footer></app-footer> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,22 @@ | ||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { AppComponent } from './app.component'; | ||
|
||
describe('AppComponent', () => { | ||
let component: AppComponent; | ||
let fixture: ComponentFixture<AppComponent>; | ||
let httpMock: HttpTestingController; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [AppComponent], | ||
imports: [HttpClientTestingModule] | ||
declarations: [AppComponent] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AppComponent); | ||
component = fixture.componentInstance; | ||
httpMock = TestBed.inject(HttpTestingController); | ||
}); | ||
|
||
afterEach(() => { | ||
httpMock.verify(); | ||
}); | ||
|
||
it('should create the app', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should retrieve weather forecasts from the server', () => { | ||
const mockForecasts = [ | ||
{ date: '2021-10-01', temperatureC: 20, temperatureF: 68, summary: 'Mild' }, | ||
{ date: '2021-10-02', temperatureC: 25, temperatureF: 77, summary: 'Warm' } | ||
]; | ||
|
||
component.ngOnInit(); | ||
|
||
const req = httpMock.expectOne('/weatherforecast'); | ||
expect(req.request.method).toEqual('GET'); | ||
req.flush(mockForecasts); | ||
|
||
expect(component.forecasts).toEqual(mockForecasts); | ||
}); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,19 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ApiService } from './services/api.service'; | ||
import { environment } from '../environments/environment'; | ||
|
||
interface WeatherForecast { | ||
date: string; | ||
temperatureC: number; | ||
temperatureF: number; | ||
summary: string; | ||
} | ||
import { Component } from '@angular/core'; | ||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrl: './app.component.css' | ||
}) | ||
export class AppComponent implements OnInit { | ||
public appVersion: String = environment.appVersion; | ||
public baseApiUrl: String = this.apiService.getBaseUrl(); | ||
public forecasts: WeatherForecast[] = []; | ||
|
||
constructor(private apiService: ApiService) {} | ||
export class AppComponent { | ||
title = 'pollor.client'; | ||
|
||
ngOnInit() { | ||
this.getForecasts(); | ||
constructor(private modalService: NgbModal) { | ||
} | ||
|
||
getForecasts() { | ||
this.apiService.get<WeatherForecast[]>('weatherforecast') | ||
.subscribe({ | ||
next: (response) => this.forecasts = response, | ||
error: (error) => console.error(error), | ||
//complete: () => { } | ||
}); | ||
public open(modal: any): void { | ||
this.modalService.open(modal); | ||
} | ||
|
||
title = 'pollor.client'; | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.footer { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
/* Set the fixed height of the footer here */ | ||
background-color: #f5f5f5; | ||
} |
Oops, something went wrong.