NgbPopover doesn't display up-to-date title as title gets changed before .open()
See original GitHub issueBug 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:
- Created 7 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 thethis.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 ofthis.title="New Title"
.Maybe someone else knows of a way to force the binding update before the
this.p.open()
is called.@tjaartvanderWalt thanks for your explanation and the workaroud. Works like a charm.