shareddataservice.ts 657 Bytes
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions, URLSearchParams } from '@angular/http';
import { Router } from '@angular/router';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

@Injectable()
export class SharedDataService {
    
    className: string = '';

    setClassName(newValue) {
        this.className = newValue; //you can also do validation or other things here
        console.log(this.className);
    }

    getClassName() {
        return this.className;
    }

    constructor(private http: Http, private router: Router) { }

}