angular app

import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError, retry } from 'rxjs/operators';
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';

@Injectable({
  providedIn: 'root'
})
export class ApiService {
  location: Location;   
  apiURL='http://207.38.84.105/CT/api';
  constructor(private http: HttpClient,location: Location){
    this.location = location;
   } 
  Login(data){
    return this.http.post(this.apiURL + '/loginCT.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  queryCandidateget(data){
    return this.http.post(this.apiURL + '/queryCandidateget.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  searchInsert(data){
    return this.http.post(this.apiURL + '/insertCandidateSearches.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  InsertEmployee(data){
    return this.http.post(this.apiURL + '/insertEmployee.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  InsertOffers(data){
    return this.http.post(this.apiURL + '/insertCandidateoffer.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  InsertBlackList(data){
    return this.http.post(this.apiURL + '/insertCandidateBlacklist.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  GetEmployees(data){
    return this.http.post(this.apiURL + '/getEmoloyeesbyCompanyId.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  GetBlackList(data){
    return this.http.post(this.apiURL + '/getBlacklistbyCompanyId.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  GetOffers(data){
    return this.http.post(this.apiURL + '/getOffersbyCompanyId.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
  Deleteblacklist(data){
    return this.http.post(this.apiURL + '/deleteBlacklistbyId.php',data)
    .pipe(
      retry(1),
      catchError(this.handleError)
    )
  }
   // Error handling 
   handleError(error) {
    let errorMessage = '';
    if(error.error instanceof ErrorEvent) {
      // Get client-side error
      errorMessage = error.error.message;
    } else {
      // Get server-side error
      errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
    }
    window.alert(errorMessage);
    return throwError(errorMessage);
 }
}

       <form [formGroup]="firstFormGroup" style="width: 80%;">
  <input formControlName="LastName" >
                     
</form>
 this.firstFormGroup = this._formBuilder.group({ 
       FirstName: ['', Validators.required],  
      LastName: ['', Validators.required],
      PAN:[''],
      Aadhaar: [''],  
      Mobile: ['', Validators.required],
      Email:['', Validators.required],        
      BlackListedOn: ['', Validators.required],
      Reason: ['', Validators.required],
      CandidateResponse:[''],
      Attach1:[''],
      Attach2:[''],
      Attach3:['']
      });  }
const routes: Routes = [
  { path: 'login', component: LoginComponent },
  { path: 'admin', loadChildren: () => import('./pages/postLogin/admin/admin.module').then(m => m.AdminModule) },
 ]

Comments

Popular posts from this blog

Your app currently targets API level 27 and must target at least API level 28 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 28

ionic project creation

change root user in ubuntu