I am trying to create the form of education dynamically. That is when user clicks the button "add education", it will create a form of education for user to fill info. I used the selectpicker from bootstrap for user to select year and month. However, angular2 fail to create selectpicker when loading the education form. If I create selectpicker staticlly, it will work, but not for dynamically. Really want to know what the problem is. The followings are the part of code in relative files:
apply-page.html
<div class="row education">
<div class="col-md-1 col-xs-12 page-label">
Education
</div>
<div class="col-md-10 col-xs-12 page-label-link">
<ul class="ul-no-margin">
<li *ngFor="let education of educations; let i = index">
<education-form [index]="i" [education]="education" (deleteEvent)="deleteEducation($event)"></education-form>
</li>
</ul>
<a (click)="addEducation()">Add education</a>
</div>
</div>
education.html
<select class="inline-box selectpicker" data-style="btn-secondary" data-width="auto" tabindex="-1" id="" required="">
<option value="0">Month *</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
The new education is showed here in apply-page:
<li *ngFor="let education of educations; let i = index"
<education-form [index]="i" [education]="education" (deleteEvent)="deleteEducation($event)"></education-form>
</li>
If I remove the "selectpicker" in the class attribute, then select tag works fine but it can't show the beautiful layout from the bootstrap. If I add the "selectpicker" in the class attribute, then the select tag doesn't work. It will show nothing on the screen.
Hope someone can help me solve the problem. Thank you.
ngIf?