我想实施" ng2-eonasdan-datetimepicker"在我的项目中。为此我已经提到了link
首先,我使用声明
安装了日期选择器webView
这是我的 app.component.ts 文件
WebEngine webEngine = webView.getEngine();
Worker worker = webEngine.getLoadWorker();
worker.stateProperty().addListener((Observable o) -> {
if (worker.getState() == Worker.State.SUCCEEDED) {
Platform.runLater(new Runnable() {
@Override
public void run() {
WritableImage image = webView.snapshot(
new SnapshotParameters(), new WritableImage(800, 400));
BufferedImage bufferedImage = SwingFXUtils.fromFXImage(image, null);
try {
ImageIO.write(bufferedImage, "png", new File("image.png"));
} catch (IOException va) {
va.printStackTrace();
}
}
});
}
});
这是我的 app.module.ts 文件
npm install ng2-eonasdan-datetimepicker --save
这是我的索引页面
import { Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DateTimePickerDirective } from 'ng2-eonasdan-datetimepicker/dist/datetimepicker.directive';
import 'eonasdan-bootstrap-datetimepicker';
@Component({
selector: 'my-root',
template: ` <router-outlet></router-outlet>
`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
options = {
format: "DD.MM.YYYY"
};
}
此代码没有出现此类错误,但日期选择器未呈现。如果您有任何想法,请帮助我。