【发布时间】:2018-01-24 10:27:19
【问题描述】:
它给出的错误如下:
错误 TS2307:找不到模块“mydatepicker”
这里也给出编译时错误:
从 'mydatepicker' 导入 { MyDatePickerModule };
report.module.ts:
import { FormsModule } from '@angular/forms';
import { MyDatePickerModule } from 'mydatepicker';
@NgModule({
imports: [
MyDatePickerModule,
FormsModule
]
})
report.component.ts:
import {IMyDpOptions} from 'mydatepicker';
@Component({
selector: 'app-report',
templateUrl: './report.component.html',
styleUrls: ['./report.component.css']
})
export class ReportComponent implements OnInit {
public myDatePickerOptions: IMyDpOptions = {
// other options...
dateFormat: 'dd.mm.yyyy',
};
}
report.component.html:
<my-date-picker name="mydate" [options]="myDatePickerOptions" [(ngModel)]="filterData.firstDate" required></my-date-picker>
我用:
角度:5.2.1 角 CLI:1.6.5
【问题讨论】:
-
发布你的代码module.ts和组件代码
-
你使用的是材料设计还是范式?
-
我使用普通形式。
-
显示你的模板
标签: javascript angular npm datepicker