我有一个具有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文件中导入工厂
factory / 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
}
time.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 }]
})