Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { DistrictService } from '../../services/district.service';
- import { Router } from '@angular/router';
- import { Observable } from 'rxjs';
- export class ManageAgencysComponent implements OnInit {
- columnsToDisplay=['name','Date','IsDeleted'];
- dataSource= new MatTableDataSource<IAgency>();
- constructor(
- private router: Router,
- private districtService: DistrictService,
- ) { }
- ngOnInit() {
- this.dataSource.data= this.districtService.getAgencyList(false);
- }
- import { Injectable } from '@angular/core';
- import { Observable } from 'rxjs/Rx';
- import { Response } from '@angular/http';
- import { ConfigService } from './config.service';
- import { IAgency } from '../interfaces/IAgency';
- import { HttpClient } from '@angular/common/http';
- import 'rxjs/add/operator/map';
- @Injectable()
- export class DistrictService {
- constructor(
- private _http: HttpClient,
- private _config: ConfigService
- ) { }
- getAgencyList(isDeleted: boolean): Observable<IAgency[]> {
- const url = this._config.getAgencyListURL(isDeleted);
- return this._http.get<IAgency[]>(url);
- }
- export interface IAgency {
- agencyId: number;
- agencyName: string;
- changeDateStamp: string;
- isDeleted: boolean;
- }
- export class Agency implements IAgency {
- constructor(
- public agencyId: number = 0,
- public agencyName: string = '',
- public changeDateStamp: string = '',
- public isDeleted: boolean = false
- ) {}
- }
- import { Component, OnInit } from '@angular/core';
- import { DistrictService } from '../../services/district.service';
- import { Router } from '@angular/router';
- import { Observable } from 'rxjs';
- export class ManageAgencysComponent implements OnInit {
- columnsToDisplay=['name','Date','IsDeleted'];
- dataSource= new MatTableDataSource<IAgency>();
- constructor(
- private router: Router,
- private districtService: DistrictService,
- ) { }
- ngOnInit() {
- this.districtService.getAgencyList(false).subscribe(result => this.dataSource.data =result);
- }
Add Comment
Please, Sign In to add comment