我想为我的应用程序使用交易视图小部件,而交易视图的小部件是
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div class="tradingview-widget-container__widget"></div>
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/symbols/OANDA-USDCAD/technicals/" rel="noopener" target="_blank"><span class="blue-text">Technical Analysis for USDCAD</span></a> by TradingView</div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-technical-analysis.js" async>
{
"width": "500",
"height": "450",
"locale": "en",
"symbol": "OANDA:USDCAD",
"interval": "1D"
}
</script>
</div>
<!-- TradingView Widget END -->
我在polyfills后的html.index上添加了来自tradeview的脚本
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<!-- TradingView Script-->
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-technical-analysis.js" async></script>
在home.ts上
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
declare var embed-widget-technical-analysis: any;
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController){}
ionViewDidLoad(){
new embed-widget-technical-analysis.widget({
"container_id": "myContainer",
"width": "500",
"height": "450",
"locale": "en",
"symbol": "OANDA:USDCAD",
"interval": "1D"
})
}
}
在home.html上
<ion-content padding>
<div id="myContainer">
</div>
</ion-content>
在home.ts上它显示错误“找不到名称嵌入 - 小部件技术分析,我做错了什么?
答案 0 :(得分:0)
在变量上将“-”更改为“ _”。 embed-widget-technical-analysis-> embed_widget_technical_analysis 应该工作