kirstein / angular-disqus

A set of directive(s) and services for disqus to simplify the life of developers.

Home Page:kirstein.github.com/angular-disqus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comment count

Anonyfox opened this issue · comments

When I try the snippet from the README (with my settings of course) to show the comment count, I get the following javascript error:

Uncaught TypeError: Cannot call method 'appendChild' of null

in embed.js: 1.

This may be a disqus issue, but i simply don't know. Does it matter that I use the following (Jade) in a ng-repeat DIV?

a.title(ng-href="#!/news/{{item.id}}") {{item.title}}
a.label(ng-href="#!/news/{{item.id}}", data-disqus-identifier="{{item.id}}")  

I encountered the same issue.
With disqus directive, not only the data-disqus-identifier, it can be fixed.

a.label(ng-href="#!/news/{{item.id}}", disqus, data-disqus-identifier="{{item.id}}")  

i found an issue in the disqusIdentifier directive. looks like when comment counts are loaded, the directive is trying to load the embed.js script as well. this is not needed for counts, so it can be safely removed.

function loadCount(id) {
setGlobals(id, $location.absUrl(), shortname);
//addScriptTag(getShortname(), TYPE_EMBED); <--REMOVE THIS LINE
addScriptTag(getShortname(), TYPE_COUNT);
getCount();
}

just submitted a pull request with the fix, please review