DEV Community


Posted on

bootstrap-select not work in angular


Copy/paste and execute this in index.html of angular project:

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

  <meta charset="utf-8">
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">

  <script src=""></script>
  <link rel="stylesheet" href=""
    integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />
  <link href="" rel="stylesheet">

  <link rel="stylesheet" href="" />
<script src=""></script> -->

  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet"
  <!-- Latest compiled and minified JavaScript -->
  <script src=""></script>
  <!-- (Optional) Latest compiled and minified JavaScript translation files -->
  <!-- <script src="*.min.js"></script> -->

  <!-- <app-root>Loading...</app-root> -->

  <script src=""

  <!-- <script src="../node_modules/jquery/dist/jquery.js"></script>
  <script src="../node_modules/bootstrap/dist/js/bootstrap.js"></script> -->

  <script src="./assets/js/custom.js"></script>

  <select class="selectpicker" data-live-search="true">
    <option data-tokens="ketchup mustard">Hot Dog, Fries and a Soda</option>
    <option data-tokens="mustard">Burger, Shake and a Smile</option>
    <option data-tokens="frosting">Sugar, Spice and all things nice</option>



SAmple on:

Not working, select doesn't dropdown... why?
Enter fullscreen mode Exit fullscreen mode

Discussion (3)

scascalesp profile image
scascalesp Author

Uggly solution from

"Above solution didnt work for me. What i did was removing all the styles and scripts from angular.json and placing them on index.html. In that way, it started working fine. I am on Angular 9."

Alternative is appreciated

st3phhays profile image
Steph Hays • Edited on

I have not tested this nor do I know Angular, but it looks like you may need to upgrade the version of bootstrap-select you are using to at least v1.13.0. See

I would also suggest updating your version of jQuery as well if there is no specific reason why you are on v1.11.1.

Hope that helps!

scascalesp profile image
scascalesp Author • Edited on

same problem. See updated sample in post
If i try to doing by JQuery with $('.my-select').selectpicker(); show error TypeError: $(...).selectpicker is not a function