caldwell / renderjson

Render JSON into collapsible HTML
http://caldwell.github.io/renderjson
418 stars 91 forks source link

TypeError: Cannot read property 'append' of null #16

Closed SORMAS-ZohaibHassan closed 7 years ago

SORMAS-ZohaibHassan commented 7 years ago

Hi Dear, I am trying to use your library and I am facing this problem. Below is the code. Can you help me on this

angular.element(document).ready(function () { renderjson.set_icons('+', '-'); renderjson.set_show_to_level(1);

    var jsonstuff =  document.querySelector("#json");
    console.log(jsonstuff);
    jsonstuff.append(
        renderjson( $scope.nsdJSON)
    );

});
caldwell commented 7 years ago

That sounds like your jsonstuff variable is null, and not anything to do with renderjson(). I suspect your document.querySelector("#json") line isn't finding the tag with id json.

SORMAS-ZohaibHassan commented 7 years ago

Thanks a lot for your help. My problem is solved.