无法在 bootstrap-select v1.13.0-beta 上读取未定义的 属性 'Constructor'
Cannot read property 'Constructor' of undefined on bootstrap-select v1.13.0-beta
我正在使用 angularJS 5 和 boostrap 4。然后我从这里向应用程序添加了 Bootstrap-select v1.13.0-beta。
Bootstrap-select v1.13.0
我还确保 jQuery 在 Boostrap-select.js 之前加载
<form [formGroup]="userRegform" novalidate>
<fieldset class="form-group">
<select class="form-control selectpicker" name="testtype" formControlName="testtype" data-live-search="true">
<option>a</option>
<option>b</option>
<option>c</option>
</select>
</fieldset>
<button type="submit">Next</button>
</form>
如果您打算在 Angular 中将 bootstrap-select 用于非常基本的用例以外的任何用途,我强烈建议您采取措施将其包装在 angular 指令中。
虽然它没有使用最新的 v1.13.0-beta,但我有一个示例项目演示了使用 bootstrap4 在 angular 中使用 bootstrap-select:https://github.com/braheem/angular-bootstrap-select
如果您坚持使用 bootstrap-select 的 v1.13.0-beta,您可以尝试与链接项目中类似的方法,但将 bootstrap-select 的版本换成 beta您正在使用的版本。
我正在使用 angularJS 5 和 boostrap 4。然后我从这里向应用程序添加了 Bootstrap-select v1.13.0-beta。 Bootstrap-select v1.13.0
我还确保 jQuery 在 Boostrap-select.js 之前加载
<form [formGroup]="userRegform" novalidate>
<fieldset class="form-group">
<select class="form-control selectpicker" name="testtype" formControlName="testtype" data-live-search="true">
<option>a</option>
<option>b</option>
<option>c</option>
</select>
</fieldset>
<button type="submit">Next</button>
</form>
如果您打算在 Angular 中将 bootstrap-select 用于非常基本的用例以外的任何用途,我强烈建议您采取措施将其包装在 angular 指令中。
虽然它没有使用最新的 v1.13.0-beta,但我有一个示例项目演示了使用 bootstrap4 在 angular 中使用 bootstrap-select:https://github.com/braheem/angular-bootstrap-select
如果您坚持使用 bootstrap-select 的 v1.13.0-beta,您可以尝试与链接项目中类似的方法,但将 bootstrap-select 的版本换成 beta您正在使用的版本。