首页 > 解决方案 > 如何将js转换为内容浏览器的Ts?

问题描述

内容浏览器错误 将 js 文件转换为 ts 文件,但仍然面临名为 content-exlporer undefined 的错误。如何在 angular2 中使用内容资源管理器。

In js files javascript code 
    var hostURL = window.location.origin,
    baseURL = hostURL + window.location.pathname + "rest/";     
    var folderId, accessToken;
    var contentExplorer = new Box.ContentExplorer();
    var fileCollection = new Array();   

在 ts 文件中打字稿代码

声明了以下参数的所有变量并将其添加到 ngOninit 中。

  this.hostURL = window.location.origin;
  this.baseURL = this.hostURL + window.location.pathname + "rest/";
  const { ContentExplorer } = this.Box;
  this. contentExplorer = new ContentExplorer();

标签: angulartypescript

解决方案


推荐阅读