mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2026-02-08 09:05:01 +00:00
Add AureliaSpa template (#398)
This commit is contained in:
committed by
SteveSandersonMS
parent
867e60d7fd
commit
e60ea04f86
@@ -0,0 +1,24 @@
|
||||
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/whatwg-fetch.d.ts" />
|
||||
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/url.d.ts" />
|
||||
import { HttpClient } from 'aurelia-fetch-client';
|
||||
import { inject } from 'aurelia-framework';
|
||||
|
||||
@inject(HttpClient)
|
||||
export class Fetchdata {
|
||||
public forecasts: WeatherForecast[];
|
||||
|
||||
constructor(http: HttpClient) {
|
||||
http.fetch('/api/SampleData/WeatherForecasts')
|
||||
.then(result => result.json())
|
||||
.then(data => {
|
||||
this.forecasts = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface WeatherForecast {
|
||||
dateFormatted: string;
|
||||
temperatureC: number;
|
||||
temperatureF: number;
|
||||
summary: string;
|
||||
}
|
||||
Reference in New Issue
Block a user