question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NgbPopover doesn't display up-to-date title as title gets changed before .open()

See original GitHub issue

Bug description:

Having a title property binding ([popoverTitle]="title"), as you change this.title just before running NgbPopover.open() the opened popover contains the old value of this.title as a title. Closing and opening the popover then updates the title to the value of this.title.

Expected behaviour: this.title gets changed before the .open() method is called, the opening popover was expected to contain the new title.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/ZpJ6VanN9kB2KZZ1VDv4

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 2.0.0

ng-bootstrap: 1.0.0-alpha.15

Bootstrap: v4.0.0-alpha.5

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
tjaartvanderWaltcommented, Dec 23, 2016

This is not related to the popover directive itself, it seems like this is the default behavior of the @Directive decorator in angular.

It seems that the binding to @Input() title only updates after the this.p.open() method is called.

Please see example plunker where the issue is replicated using a simple custom directive.

To overcome the issue you can set the popoverTitle by going this.p.popoverTitle="New Title" instead of this.title="New Title".

Maybe someone else knows of a way to force the binding update before the this.p.open() is called.

1reaction
readme42commented, Dec 23, 2016

@tjaartvanderWalt thanks for your explanation and the workaroud. Works like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bootstrap popover not showing on top of all elements
I fixed it by adding an event to my element triggering the popover which also changed the overflow property of the responsible div...
Read more >
Popover - Angular powered Bootstrap
The string content or a TemplateRef for the content to be displayed in the popover. If the title and the content are falsy,...
Read more >
Popover | Components - BootstrapVue
The Popover feature provides a tooltip-like behavior, can be easily applied to any interactive element via the component or v-b-popover directive.
Read more >
Angular Bootstrap: How to Use It Practically? [with Examples]
Check out this hands-on example of an AngularJS Bootstrap application. Learn how to use HTML, CSS, and AngularJS to create an Angular ...
Read more >
@ng-bootstrap/ng-bootstrap@14.0.0 - jsDocs.io
For subsequent changes use methods like expand() , collapse() , etc. and ... If the title and the content are falsy, the popover...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found