Skip to content

Commit

Permalink
feat(autocomplete): make renderer constructor parameter required (#2621)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
`renderer` constructor parameter is now required.
  • Loading branch information
yggg authored Dec 16, 2020
1 parent 77a3519 commit 2cd2c78
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ export class NbAutocompleteDirective<T> implements OnDestroy, AfterViewInit, Con
protected triggerStrategyBuilder: NbTriggerStrategyBuilderService,
protected positionBuilder: NbPositionBuilderService,
protected activeDescendantKeyManagerFactory: NbActiveDescendantKeyManagerFactoryService<NbOptionComponent<T>>,
// @breaking-change @7.0.0 Make renderer required.
@Optional() protected renderer?: Renderer2,
protected renderer: Renderer2,
) {}

ngAfterViewInit() {
Expand Down Expand Up @@ -265,12 +264,7 @@ export class NbAutocompleteDirective<T> implements OnDestroy, AfterViewInit, Con
}

setDisabledState(disabled: boolean): void {
// @breaking-change @7.0.0 Keep only `this.renderer.setProperty` without `if/else`.
if (this.renderer) {
this.renderer.setProperty(this.hostRef.nativeElement, 'disabled', disabled);
} else if (this.hostRef.nativeElement) {
this.hostRef.nativeElement.disabled = disabled;
}
this.renderer.setProperty(this.hostRef.nativeElement, 'disabled', disabled);
}

protected subscribeOnOptionClick() {
Expand Down

0 comments on commit 2cd2c78

Please sign in to comment.