Skip to content

Commit dd1c35d

Browse files
authored
fix(nav): don't emit (navChange) when activeId is not set initially (#3567)
Fixes #3564
1 parent f845951 commit dd1c35d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/nav/nav.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('nav', () => {
200200
expectLinks(fixture, [true, false]);
201201
expectContents(fixture, ['content 1']);
202202
expect(activeIdChangeSpy).toHaveBeenCalledWith(1);
203-
expect(navChangeSpy).toHaveBeenCalledWith({activeId: undefined, nextId: 1, preventDefault: jasmine.any(Function)});
203+
expect(navChangeSpy).toHaveBeenCalledTimes(0);
204204
});
205205

206206
it(`should initially select nothing, if [activeId] provided is incorrect`, () => {

src/nav/nav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class NgbNav implements AfterContentInit {
201201
if (!isDefined(this.activeId)) {
202202
const nextId = this.items.first ? this.items.first.id : null;
203203
if (nextId) {
204-
this._updateActiveId(nextId);
204+
this._updateActiveId(nextId, false);
205205
this._cd.detectChanges();
206206
}
207207
}

0 commit comments

Comments
 (0)