Skip to content

Commit

Permalink
fix(module: popupservice): fix popupservice get component name with b…
Browse files Browse the repository at this point in the history
…uild prod runtime error (#333)
  • Loading branch information
Guoyuanqiang authored and fisherspy committed Mar 12, 2019
1 parent dd88a52 commit b69ee5a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/action-sheet/action-sheet.service.ts
Expand Up @@ -56,7 +56,7 @@ export class ActionSheet extends PopupService {

static _open(props: ActionSheetOptions) {
setTimeout(() => {
ActionSheet.comRef = ActionSheet.showPopup(ActionSheetComponent);
ActionSheet.comRef = ActionSheet.showPopup('ActionSheetComponent', ActionSheetComponent);
ActionSheet.comRef.instance.option = props;
}, 0);
}
Expand Down
6 changes: 4 additions & 2 deletions components/core/services/popup.service.ts
Expand Up @@ -16,6 +16,7 @@ export class PopupService {
}

static showPopup(
componentName,
component,
childInjector?: Injector,
hasBackdrop?: boolean,
Expand All @@ -28,9 +29,10 @@ export class PopupService {
PopupService.overlayRef.backdropClick().subscribe(() => {
PopupService.hidePopup();
});
PopupService.currentServiceName = component.name;
PopupService.currentServiceName = componentName;
console.log(component, childInjector);
const comRef = PopupService.overlayRef.attach(new ComponentPortal(component, undefined, childInjector));
PopupService.serviceArray.push({key: component.name, value: PopupService.overlayRef});
PopupService.serviceArray.push({key: componentName, value: PopupService.overlayRef});
return comRef;
}

Expand Down
2 changes: 1 addition & 1 deletion components/modal/modal.service.ts
Expand Up @@ -65,7 +65,7 @@ export class Modal extends PopupService {
}
]);
setTimeout(() => {
Modal.modalRef = Modal.showPopup(ModalServiceComponent, childInjector);
Modal.modalRef = Modal.showPopup('ModalServiceComponent', ModalServiceComponent, childInjector);
}, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion components/picker/picker.service.ts
Expand Up @@ -34,7 +34,7 @@ export class Picker extends PopupService {
useValue: options
}
]);
Picker.showPopup(PickerComponent, childInjector);
Picker.showPopup('PickerComponent', PickerComponent, childInjector);
}

static hidePicker(): void {
Expand Down

0 comments on commit b69ee5a

Please sign in to comment.