These are chat archives for angular/angular-2-ionic-2

7th
Aug 2018
Aubrey Quinn
@aubrey-fowler
Aug 07 2018 11:25
Hi all, why would my service be defined in one function but not the other?

import { Injectable } from '@angular/core';
import { LicenseDataService } from './licenseData.service';

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/finally';

import { Spinner } from '../../app/core/services/spinner.service';

@Injectable()
export class LicenseService {

constructor(private licenseDataService: LicenseDataService, private spinner: Spinner) { }

getWebwiseVersion() {

    console.log(' get ', this.spinner); //defined
    this.spinner.show();

    return this.licenseDataService.getLicenseInfo()
        .map(this.handleSuccess)
        .finally(this.handleFinally);
}

handleFinally() {
    console.log(' finally ', this.spinner); //undefined
    this.spinner.hide();
}

handleSuccess(response) {
    console.log(response['versionNumberField']);
    return response['versionNumberField'];
}

}