File

projects/app-base-library/src/lib/angular/services/form.service.ts

Index

Properties
Methods

Constructor

constructor()

Methods

errorHandler
errorHandler(error: any)
Parameters :
Name Type Optional
error any no
Returns : void
Public init
init(options: )
Parameters :
Name Optional
options no
Returns : void

Properties

Public model
model: any
Type : any
import { Injectable, EventEmitter } from '@angular/core';
// import { Observable } from 'rxjs/Rx';

@Injectable()
export class FormService {
  public model: any;

  constructor() { }

  public init(options) {

  };

  // todo: errorHandler
  errorHandler(error: any) {
    console.log(error);
    // AppService.scope.$broadcast('formError', error);
    // if(AppSettings.dev){
    //   console.log(error);
    // }
    // if(!error){
    //   return;
    // }
    // if(error.data === "token expired"){
    //   toastr.warning($filter('translate')('LOGIN EXPIRED')+'.');
    //   service.logOut();
    //   return;
    // }
    // if (error.statusText === 'Bad Request' || error.status == 400) {
    //   if (error.data.message) {
    //     toastr.warning($filter('translate')(error.data.message));
    //   } else {
    //     toastr.warning($filter('translate')('ERROR BAD REQUEST') + '.');
    //   }
    // }
    // if(error.statusText === 'Unauthorized' || error.status == 401){
    //   toastr.warning($filter('translate')('UNAUTHORIZED ERROR')+'.');
    //   service.logOut();
    //   return;
    // }
    // if(error.statusText === 'Not found' || error.status == 404){
    //   toastr.warning($filter('translate')('ERROR NOT FOUND')+'.');
    // }
  }


}

results matching ""

    No results matching ""