Skip to content

Commit 366e073

Browse files
fix failing test broken by last commit (if event.button is null, uiSref should apparently open in a new window for some reason)
1 parent c1c275f commit 366e073

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/directives/uiSref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @ng2api @module directives */
22
/** */
3-
import { UIRouter, extend, Obj, TransitionOptions, TargetState } from '@uirouter/core';
3+
import { UIRouter, extend, Obj, TransitionOptions, TargetState, isNumber } from '@uirouter/core';
44
import { Directive, Inject, Input, Optional, ElementRef, Renderer2, OnChanges, SimpleChanges, HostListener } from '@angular/core';
55
import { UIView, ParentUIViewInject } from './uiView';
66
import { ReplaySubject } from 'rxjs/ReplaySubject';
@@ -170,7 +170,7 @@ export class UISref implements OnChanges {
170170
/** When triggered by a (click) event, this function transitions to the UISref's target state */
171171
@HostListener('click', ['$event.button', '$event.ctrlKey', '$event.metaKey'])
172172
go(button: number, ctrlKey: boolean, metaKey: boolean) {
173-
if (this._anchorUISref && (this._anchorUISref.openInNewTab() || button || ctrlKey || metaKey)) {
173+
if (this._anchorUISref && (this._anchorUISref.openInNewTab() || button || !isNumber(button) || ctrlKey || metaKey)) {
174174
return;
175175
}
176176

0 commit comments

Comments
 (0)