Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dirDisqus: prevent error when config object is undefined #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niklanus
Copy link

@niklanus niklanus commented Apr 30, 2016

I ran into this error TypeError: Cannot read property 'disqus_shortname' of undefined when using a config object that got their data asynchronously, in my WP REST API + AngularJS front-end blog.

Template:
<dir-disqus config="disqusConfig"></dir-disqus>

Controller:

afterSomeAjaxStuff(function(){
    $scope.disqusConfig = {
        disqus_shortname: 'myShortname',
        disqus_identifier: $stateParams.slug,
        disqus_url: $scope.currentURL
    };
});

This is just a simple flag to check that the config object actually has some data before continuing to execute the rest of configChanged().

@Hacksore
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants