Skip to content

Commit

Permalink
fix(mapService): remove mapService
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Feb 28, 2019
1 parent dee3b63 commit 96c855c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 51 deletions.
1 change: 0 additions & 1 deletion packages/geo/src/lib/print/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './shared';
export * from './print/print.component';
export * from './print/print-binding.directive';
export * from './print-form';
15 changes: 4 additions & 11 deletions packages/geo/src/lib/print/print.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {
Expand All @@ -15,7 +15,6 @@ import { IgoLanguageModule } from '@igo2/core';
import { IgoKeyValueModule } from '@igo2/common';

import { PrintComponent } from './print/print.component';
import { PrintBindingDirective } from './print/print-binding.directive';
import { PrintFormComponent } from './print-form/print-form.component';

@NgModule({
Expand All @@ -33,13 +32,7 @@ import { PrintFormComponent } from './print-form/print-form.component';
IgoLanguageModule,
IgoKeyValueModule
],
exports: [PrintComponent, PrintBindingDirective, PrintFormComponent],
declarations: [PrintComponent, PrintBindingDirective, PrintFormComponent]
exports: [PrintComponent, PrintFormComponent],
declarations: [PrintComponent, PrintFormComponent]
})
export class IgoPrintModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: IgoPrintModule
};
}
}
export class IgoPrintModule {}
22 changes: 0 additions & 22 deletions packages/geo/src/lib/print/print/print-binding.directive.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
import {
Directive,
Self,
OnInit,
AfterViewInit,
Optional
} from '@angular/core';

import { RouteService } from '@igo2/core';

import { MapService } from '../../map/shared/map.service';
import { RoutingFormComponent } from './routing-form.component';
import { RoutingFormService } from './routing-form.service';

@Directive({
selector: '[igoRoutingFormBinding]'
})
export class RoutingFormBindingDirective implements OnInit, AfterViewInit {
private component: RoutingFormComponent;
export class RoutingFormBindingDirective implements AfterViewInit {

constructor(
@Self() component: RoutingFormComponent,
private mapService: MapService,
@Self() private component: RoutingFormComponent,
private routingFormService: RoutingFormService,
@Optional() private route: RouteService
) {
this.component = component;
}

ngOnInit() {
this.component.map = this.mapService.getMap();
}
) {}

ngAfterViewInit(): void {
const storedStopsCoordinates = this.routingFormService.getStopsCoordinates();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component } from '@angular/core';

import { ToolComponent } from '@igo2/common';
import { IgoMap } from '@igo2/geo';

import { MapState } from '../../map/map.state';

@ToolComponent({
name: 'directions',
Expand All @@ -12,5 +15,9 @@ import { ToolComponent } from '@igo2/common';
templateUrl: './directions-tool.component.html'
})
export class DirectionsToolComponent {
constructor() {}
get map(): IgoMap {
return this.mapState.map;
}

constructor(private mapState: MapState) {}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<igo-print igoPrintBinding></igo-print>
<igo-print [map]="map"></igo-print>
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Component } from '@angular/core';

import { ToolComponent } from '@igo2/common';
import { IgoMap } from '@igo2/geo';

import { MapState } from '../../map/map.state';

@ToolComponent({
name: 'print',
Expand All @@ -12,5 +15,9 @@ import { ToolComponent } from '@igo2/common';
templateUrl: './print-tool.component.html'
})
export class PrintToolComponent {
constructor() {}
get map(): IgoMap {
return this.mapState.map;
}

constructor(private mapState: MapState) {}
}

0 comments on commit 96c855c

Please sign in to comment.