I want to use Bootstrap 5 popovers in my Angular app.
Here's what I do:
my index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>my website</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<script>
var popover = new bootstrap.Popover(document.querySelector('.popoverable'), {
container: 'body'
})
</script>
</body>
</html>
app.component.html
<button type="button" class="btn btn-secondary popoverable" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Bottom popover">
Popover on bottom
</button>
Then on my page I see my styled button, but the popover doesn't appear and in the console I get a Uncaught TypeError: this._element is undefined
.
Does anybody have a solution to my issue ?
question from:
https://stackoverflow.com/questions/65935175/why-my-popovers-from-bootstrap-5-return-a-uncaught-typeerror 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…