How to add disqus to Ionic app? -
i'm new ionic framework, , created simple side-menu app , want add disqus comments it. how code looks like:
i add srcipt <head>
in index.html
:
<script type="text/javascript"> /* * * configuration variables: edit before pasting webpage * * */ var disqus_shortname = '<hooligansapp>'; // required - replace '<example>' forum shortname /* * * don't edit below line * * */ (function() { var dsq = document.createelement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getelementsbytagname('head')[0] || document.getelementsbytagname('body')[0]).appendchild(dsq); })();
and template:
<ion-view view-title="comments"> <ion-content> <div id="disqus_thread"></div> </ion-content> </ion-view>
and nothing happend :(
so, how can fix it?
you have place configuration variables , script within controller of view.
controllers.collectionscommentsctrl = function($scope) { var disqus_shortname = 'your_id'; (function() { var dsq = document.createelement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//your_id.disqus.com/embed.js'; (document.getelementsbytagname('head')[0] || document.getelementsbytagname('body')[0]).appendchild(dsq); })(); }
here can see result:
Comments
Post a Comment