首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用角Angular以角6加载图像

无法使用角Angular以角6加载图像
EN

Stack Overflow用户
提问于 2018-12-19 10:28:50
回答 1查看 886关注 0票数 2

我对角6比较陌生,我正试图在我的角6应用程序中包括角石。但我遇到了这样的错误:

错误TS7016:找不到模块“基石-核心/dist/kerstone.js”的声明文件

我已经安装了基石核心使用npm install cornerstone-core

有人能指出为什么这段代码不起作用吗?

component.ts

代码语言:javascript
复制
import { Component, ElementRef, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import * as cornerstone from 'cornerstone-core/dist/cornerstone.js';

@Component({
  selector: 'image-stack-viewer',
  templateUrl: './image-stack-viewer.component.html',
  styleUrls: ['./image-stack-viewer.component.css']
})
export class ImageStackViewerComponent implements OnInit, AfterViewInit {
  @ViewChild('testpod') canvasDiv: ElementRef;

  constructor() { }

  ngOnInit() {
  }

  ngAfterViewInit() {
    const imageId = ''//my-mage-url;

    var element = this.canvasDiv;
    cornerstone.enable(this.canvasDiv);
    cornerstone.loadImage(imageId).then(function (image:any) {
      cornerstone.displayImage(element, image);  
    });
  }
}

代码语言:javascript
复制
<div #testpod width="500" height="400"></div>
EN

回答 1

Stack Overflow用户

发布于 2018-12-19 10:40:53

你必须宣布这样的基石:

代码语言:javascript
复制
declare const cornerstone;

看看这个存储库,可以找到示例:https://github.com/avatsaev/angular-cornerstone-example

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53849248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档