Skip to content

Commit

Permalink
fix(*): fix invalid service (#142)
Browse files Browse the repository at this point in the history
- close #141
  • Loading branch information
cipchk committed May 14, 2019
1 parent b9ddc6d commit a95da21
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 19 deletions.
2 changes: 0 additions & 2 deletions components/actionsheet/actionsheet.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { ActionSheetComponent } from './actionsheet.component';
import { ActionSheetService } from './actionsheet.service';

@NgModule({
imports: [CommonModule],
declarations: [ActionSheetComponent],
exports: [ActionSheetComponent],
providers: [ActionSheetService],
entryComponents: [ActionSheetComponent],
})
export class ActionSheetModule {}
17 changes: 13 additions & 4 deletions components/actionsheet/actionsheet.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

import { DOCUMENT } from '@angular/common';
import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector } from '@angular/core';
import { BaseService } from 'ngx-weui/core';
import { Observable } from 'rxjs';
import { ActionSheetComponent } from './actionsheet.component';
import { ActionSheetConfig } from './actionsheet.config';

@Injectable()
@Injectable({ providedIn: 'root' })
export class ActionSheetService extends BaseService {
constructor(
resolver: ComponentFactoryResolver,
applicationRef: ApplicationRef,
injector: Injector,
@Inject(DOCUMENT) doc: any,
) {
super(resolver, applicationRef, injector, doc);
}

/**
* 创建一个弹出式菜单并显示
*
Expand Down
2 changes: 0 additions & 2 deletions components/dialog/dialog.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { MaskModule } from 'ngx-weui/mask';
import { SliderModule } from 'ngx-weui/slider';

import { DialogComponent } from './dialog.component';
import { DialogService } from './dialog.service';

@NgModule({
imports: [CommonModule, FormsModule, MaskModule, FormModule, SliderModule],
declarations: [DialogComponent],
exports: [DialogComponent],
providers: [DialogService],
entryComponents: [DialogComponent],
})
export class DialogModule {}
14 changes: 12 additions & 2 deletions components/dialog/dialog.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import { Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector } from '@angular/core';
import { BaseService } from 'ngx-weui/core';
import { Observable } from 'rxjs';
import { DialogComponent } from './dialog.component';
import { DialogConfig } from './dialog.config';

@Injectable()
@Injectable({ providedIn: 'root' })
export class DialogService extends BaseService {
constructor(
resolver: ComponentFactoryResolver,
applicationRef: ApplicationRef,
injector: Injector,
@Inject(DOCUMENT) doc: any,
) {
super(resolver, applicationRef, injector, doc);
}

/**
* 创建一个对话框并显示
*
Expand Down
2 changes: 0 additions & 2 deletions components/picker/picker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import { CityPickerComponent } from './picker-city.component';
import { DatePickerComponent } from './picker-date.component';
import { PickerGroupComponent } from './picker-group.component';
import { PickerComponent } from './picker.component';
import { PickerService } from './picker.service';

const COMPONENTS = [PickerComponent, PickerGroupComponent, DatePickerComponent, CityPickerComponent];

@NgModule({
imports: [CommonModule],
declarations: COMPONENTS,
exports: COMPONENTS,
providers: [PickerService],
entryComponents: COMPONENTS,
})
export class PickerModule {}
18 changes: 13 additions & 5 deletions components/picker/picker.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

import { DOCUMENT } from '@angular/common';
import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector } from '@angular/core';
import { BaseService } from 'ngx-weui/core';

import { Observable } from 'rxjs';
import { PickerData } from './data';
import { PickerOptions } from './options';
import { CityPickerComponent } from './picker-city.component';
Expand All @@ -12,8 +11,17 @@ import { PickerComponent } from './picker.component';
/**
* 多列选择器Service,可直接通过Class构造选择器
*/
@Injectable()
@Injectable({ providedIn: 'root' })
export class PickerService extends BaseService {
constructor(
resolver: ComponentFactoryResolver,
applicationRef: ApplicationRef,
injector: Injector,
@Inject(DOCUMENT) doc: any,
) {
super(resolver, applicationRef, injector, doc);
}

/**
* 构建一个多列选择器并显示
*
Expand Down
11 changes: 10 additions & 1 deletion components/toast/toast.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector } from '@angular/core';
import { BaseService } from 'ngx-weui/core';
import { ToastComponent } from './toast.component';

@Injectable({ providedIn: 'root' })
export class ToastService extends BaseService {
constructor(
resolver: ComponentFactoryResolver,
applicationRef: ApplicationRef,
injector: Injector,
@Inject(DOCUMENT) doc: any,
) {
super(resolver, applicationRef, injector, doc);
}
/**
* 构建toast并显示
*
Expand Down
12 changes: 11 additions & 1 deletion components/toptips/toptips.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { ApplicationRef, ComponentFactoryResolver, Inject, Injectable, Injector } from '@angular/core';
import { BaseService } from 'ngx-weui/core';
import { ToptipsComponent, ToptipsType } from './toptips.component';

@Injectable({ providedIn: 'root' })
export class ToptipsService extends BaseService {
constructor(
resolver: ComponentFactoryResolver,
applicationRef: ApplicationRef,
injector: Injector,
@Inject(DOCUMENT) doc: any,
) {
super(resolver, applicationRef, injector, doc);
}

/**
* 构建一个Toptips并显示
*
Expand Down

0 comments on commit a95da21

Please sign in to comment.