mdbootstrap / mdb-ui-kit

Bootstrap 5 & Material Design UI KIT
https://mdbootstrap.com/docs/standard/
Other
24.06k stars 3.53k forks source link

dropdown , ripples does not work on angular 17 #1535

Open Kaizodo opened 5 months ago

Kaizodo commented 5 months ago

i have angular 17 fresh project , when add buttons and dropdowns on index.html everything works fine however when i add same into angular component (or dynamically created content) it seems ripples and dropdowns does not work its like events are bound when all content is loaded. i tested the same with older mdb version 4.x on that only ripples were working again dropdowns were not opening .

this is my index.html file of angular 17 project

index.html

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Angular 17</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/png" href="/assets/img/logo/sm.png">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
  <link href="/assets/mdb/css/mdb.min.css" rel="stylesheet">
</head>

<body>
  <app-root></app-root>
  <script src="./assets/mdb/js/mdb.umd.min.js"></script>
</body>

</html>

app.component.html i get no ripple and no dropdown although css does work properly as expected its just javascript which is not working

<div class="dropdown">
  <button
    class="btn btn-primary dropdown-toggle"
    type="button"
    id="dropdownMenuButton"
    data-mdb-dropdown-init
    data-mdb-ripple-init
    aria-expanded="false"
  >
    Dropdown button
  </button>
  <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

i have tested Accordion and its working fine even on dynamically loaded content.

Shigure92 commented 2 months ago

We have package dedicated to Angular: https://github.com/mdbootstrap/mdb-angular-ui-kit