2017-04-03 44 views
0

我是angular 2的新用戶,並且正在編寫一個新的客戶端angular2 cli生成的應用程序(使用webpack2)。我的組件需要使用這個外部庫https://github.com/splunk/splunk-sdk-javascript的splunkjs對象。 我希望能夠得到這個splunkjs對象,但我不能給angular2應用程序的組件內這樣做:在angular2 + webpack應用程序中使用外部庫

var http = new splunkjs.JQueryHttp(); 

在獨立的JavaScript,我用我能得到它:

<html> 
    <head> 
    <title>Test</title> 
    <script type="text/javascript" src="jquery.min.js"></script> 
    <script type="text/javascript" src="splunk.js"></script> 
    <script type="text/javascript" charset="utf-8"> 
    function test() { 
var http = new splunkjs.JQueryHttp(); 
console.log(' http is ' + JSON.stringify(http)); 
} 
    </script> 
</head> 
<body> 
    <button type="button" onclick="test()">Test</button> 
</body> 

什麼是在我的角度組件上面做的步驟呢?

回答

相關問題