小编Mos*_*eri的帖子

角度材料 TimePicker ngx-material-timepicker 错误未捕获(承诺):TypeError: Object(...) is not a function

我从这里使用 ngx-material-timepicker timePicker install 命令,npm install --save ngx-material-timepicker 我还安装了依赖项 luxon 和 tslib 并根据 npm

   import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker';
    @NgModule({
      imports: [NgxMaterialTimepickerModule]
    })
Run Code Online (Sandbox Code Playgroud)

并在我的 html 文件中

<input [ngxTimepicker]="picker">
<ngx-material-timepicker #picker></ngx-material-timepicker>
Run Code Online (Sandbox Code Playgroud)

但错误

core.js:15724 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at ngx-material-timepicker.js:231
    at Module../node_modules/ngx-material-timepicker/fesm5/ngx-material-timepicker.js (ngx-material-timepicker.js:238)
    at __webpack_require__ (bootstrap:83)
    at Module../src/app/modules/management/admin/admin.module.ts (admin-routing.module.ts:145)
    at __webpack_require__ (bootstrap:83)
    at $_lazy_route_resource lazy namespace object:34
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:17299)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at …
Run Code Online (Sandbox Code Playgroud)

timepicker angular-material angular

2
推荐指数
1
解决办法
7780
查看次数

角材料垫选择 ngModel 布尔值不起作用

我使用 mat-select 在 angular 7 项目和 angular material 中选择用户的性别

 <mat-form-field>
          <mat-select placeholder="Gender" required 
            formControlName="isMale" 
            [(ngModel)]="userProfile.isMale">
            <mat-option value="false">Women</mat-option>
            <mat-option value="true">Men</mat-option>
          </mat-select>
          <mat-hint align="end">Please Select...</mat-hint>
          <mat-error *ngIf="isControlHasError('isMale','required')"><strong>Please Select Gender</strong>
          </mat-error>
        </mat-form-field>
Run Code Online (Sandbox Code Playgroud)

userProfile 从服务器获取,isMale 属性是布尔类型,但获取数据后在 mat-select 上不显示所选值我也使用这种方式但不起作用

        <mat-option [value]="'false'">Women</mat-option>
        <mat-option [value]="'true'">Men</mat-option>
Run Code Online (Sandbox Code Playgroud)

但它不起作用

angular-material ngmodel angular

1
推荐指数
1
解决办法
5034
查看次数

标签 统计

angular ×2

angular-material ×2

ngmodel ×1

timepicker ×1