2017-04-15 7 views
0

TypescriptとAngular 4を使い始めたばかりで、Google Code-PrettifyとAngle CLIを統合する際に問題があります。Google Code-PrettifyでTypscriptとAngularを使用する4

私はコードをどのようにインポートするのかを理解しようとしていますが、私のコンポーネントで動的に使用するようにすっきりしていますが、これを達成する方法がわかりません。

私はNPMでインストールし、パッケージからPRをインポートしようとしましたが、PRは空のオブジェクトとして入ります。

私は何をしようとしていますか?

おかげ

答えて

1
you can change some code in prettify.js: 


             
  
//old code in here 
 
if (typeof define === "function" && define['amd']) { 
 
    define("google-code-prettify", [], function() { 
 
    \t return PR; 
 
    \t }); 
 
} 
 
//new code in here 
 
     
 
if(typeof module==="object"&&typeof module.exports==="object") { 
 
    module.exports = PR; 
 
} else if (typeof define === "function" && define['amd']) { 
 
    define("google-code-prettify", [], function() { 
 
    \t return PR; 
 
    }); 
 
}
use case like this:
let prettify = require('../../dep/prettify'); 
 
$("#doc-view").html(virtualDom); 
 
prettify.prettyPrint();
+0

私はまだこれを試す機会を得たが、まさに私が探していたもののように見えていません。ありがとう! – Mattador

関連する問題