Files
blog-frontEnd/index/src/app/services/count/count.service.ts
2019-11-28 19:26:45 +08:00

25 lines
498 B
TypeScript

import {Injectable} from '@angular/core';
import {HttpService} from '../http.service';
import {Count} from '../../class/count';
@Injectable({
providedIn: 'root'
})
export class CountService {
constructor(public http: HttpService) {
}
count: Count;
getCount() {
const observable = this.http.get('/counts');
observable.subscribe((data: any) => {
if (data.code === 0) {
this.count = data.result;
}
});
return observable;
}
}