我有这个工厂,它有 ngx-timpicker factory.ts,我想将它包含在我的 ts 文件中以在我的 time.ts 文件中使用工厂,但是我在 time.ts 文件中的导入行中遇到错误 -
TS2305: Module '"../../factories/timepickerconfig.factory"' has no exported member 'TimepickerConfig'.
7 import { TimepickerConfig } from '../../factories/timepickerconfig.factory';
~~~~~~~~~~~~~~~~
import { TimepickerConfig } from '../../factories/timepickerconfig.factory';
如何在ts文件中导入工厂
工厂/timepickerconfig.factory.ts
import { TimepickerConfig } from 'ngx-bootstrap/timepicker';
useFactory: () => {
const timepickerConfig = new TimepickerConfig();
timepickerConfig.hourStep = 2;
timepickerConfig.minuteStep = 10,
timepickerConfig.showMeridian = false,
timepickerConfig.readonlyInput = false,
timepickerConfig.mousewheel = true,
timepickerConfig.showMinutes = true,
timepickerConfig.showSeconds = false
}
时间.ts
import { TimepickerConfig } from '../../factories/timepickerconfig.factory';
@Component({
selector: 'time',
templateUrl: './time.html',
styleUrls: ['./time.scss'],
encapsulation: ViewEncapsulation.None,
providers: [
{ provide: TimepickerConfig, useFactory: TimepickerConfig },
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS }]
})