As it is mentioned in documentation you have to include few dependencies to make Bootstrap fully working.
To include libraries required by Bootstrap - you can add script tags to your index.html
file. At the end of body
.
<my-app>loading</my-app>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
Then, to iterate through items
declared in component you can use *ngFor
like below:
<a class="dropdown-item" *ngFor="let item of items; let i = index" [href]="item.url">{{item.name}}</a>
Demo
If you don't want to use jQuery: - you have to implement logic which will be responsible for action after toggle is clicked.
Here you can see example which is implementing logic to toggle dropdown menu.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…