Skip to content

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