我找到了一个示例,但它不是一个成角度的example here,我试图为某个图像区域选择器创建我的angular 6
项目,但无法正常工作,我遇到了这个错误
.component.ts(64,16):错误TS2339:属性'imgAreaSelect'不存在 类型'“ #bee”'上存在。
任何人都知道如何将其放入Angular 6
预先感谢
component.html
<div id="bee">
<img src="/assets/sg-img/documents/test-2.jpg" width="100%;">
<!--- documents-->
</div>
component.ts
ngOnInit() {
{
('#bee').imgAreaSelect({ aspectRatio: '1:1', handles: true });
};
}
.css
/*image area*/
.imgareaselect-border1, .imgareaselect-border2,
.imgareaselect-border3, .imgareaselect-border4 {
opacity: 0.5;
filter: alpha(opacity=50);
}
.imgareaselect-handle {
background-color: #fff;
border: solid 1px #000;
opacity: 0.5;
filter: alpha(opacity=50);
}
.imgareaselect-outer {
background-color: #000;
opacity: 0.5;
filter: alpha(opacity=50);
}
.imgareaselect-selection {
}
答案 0 :(得分:1)
First you have to include JQuery as project dependency. This part is done here https://stackblitz.com/edit/angular-ggtn2q?file=src%2Findex.html
Later on you have to include required plugin as static asset and include it as sources. This cannot be done on stackblitz. Required pligin sources you can get here https://cdnjs.com/libraries/imgareaselect
Here is explained how to include jquery plugin https://medium.com/all-is-web/angular-5-using-jquery-plugins-5edf4e642969