3
我目前正在爲自己的新博客上使用angular和rails,並且卡住了。我用ng-bind-html
來注入我後端的代碼。如何加載Gist代碼而不會出現異步錯誤
現在我用自己的指令修復它。
我目前得到當我試圖從GitHub的主旨服務導入代碼示例以下錯誤:
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
的原因是什麼,如何解決這一問題?提前致謝!
我們展示你的代碼。 – SLaks
看起來很明顯,你不能在頁面加載後使用'document.write',否則它會消除頁面中的所有內容。 – charlietfl
需要更多信息/代碼示例/庫用於幫助你。我遇到了類似的問題。我使用[gist-embed](https://github.com/blairvanderhoof/gist-embed)庫。當使用ng-bind-html時,我必須用'''gist()''重新編譯綁定的html。也可以看看https://github.com/pasupulaphani/angular-gist-embed,它可以幫助你。 – phani