Affichage du titre des pages dans la navigation
This commit is contained in:
@@ -14,6 +14,7 @@ export class AppComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.componentTitle.subscribe(title => this.title = title);
|
||||
}
|
||||
|
||||
toggleMenu() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-aircrafts',
|
||||
@@ -10,10 +11,11 @@ import { ServiceApi } from '../../services/serviceApi';
|
||||
export class ListOfAircraftsComponent implements OnInit {
|
||||
public listOfAircrafts: Array<AircraftResp> = new Array<AircraftResp>();
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
constructor(private serviceApi: ServiceApi, private serviceComm: ServiceComm) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of aircrafts');
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, Injectable } from '@angular/core';
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-dzs',
|
||||
@@ -12,10 +13,12 @@ import { ServiceApi } from '../../services/serviceApi';
|
||||
export class ListOfDzsComponent implements OnInit {
|
||||
public listOfDropZones: Array<DropZoneResp> = new Array<DropZoneResp>();
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
constructor(private serviceApi: ServiceApi,
|
||||
private serviceComm: ServiceComm) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of DZs');
|
||||
this.getListOfDropZones();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jump-types',
|
||||
@@ -10,10 +11,11 @@ import { ServiceApi } from '../../services/serviceApi';
|
||||
export class ListOfJumpTypesComponent implements OnInit {
|
||||
public listOfJumpTypes: Array<JumpTypeResp> = new Array<JumpTypeResp>();
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
constructor(private serviceApi: ServiceApi, private serviceComm: ServiceComm) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of jump types');
|
||||
this.getListOfJumpTypes();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { JumpResp } from '../../models/jump';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jumps',
|
||||
@@ -11,10 +13,11 @@ import { ServiceApi } from '../../services/serviceApi';
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
public listOfJumps: Observable<Array<JumpResp>>;
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
constructor(private serviceApi: ServiceApi, private serviceComm: ServiceComm) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('List of jumps');
|
||||
this.getListOfJumps();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-jump',
|
||||
@@ -7,9 +8,10 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class NewJumpComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private serviceComm: ServiceComm) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('Add a new jump');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/serviceComm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-summary',
|
||||
@@ -7,9 +8,10 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class SummaryComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private serviceComm: ServiceComm) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle('Summary');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
|
||||
@Injectable()
|
||||
export class ServiceComm {
|
||||
private componentTitleSource = new BehaviorSubject<string>("");
|
||||
componentTitle = this.componentTitleSource.asObservable();
|
||||
|
||||
constructor() { }
|
||||
|
||||
updatedComponentTitle(title: string) {
|
||||
this.componentTitleSource.next(title);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user