'Angular , plotly and dynamic components

Am New to Angularjs world and am getting coordinates in my API response which i want to draw on my HTML and am using plotly.js for it. problem am facing is whenever i give hard coded value in div it works but when i give dynamic value i get error DOM is null error.

HTML code

    <div >
    <div class="ccow">
     <div class="flux-graph" ng-repeat="data in multipledata" ng-show="true">
     <div id={{$index}}  style="width:600px;height:250px;" 
            ng-init="getIcfrCharts(data,index)"></div>       

JS code

 $scope.getIcfrCharts = function(upstream,index) {
 iCFRCharts = document.getElementById("'" + index +"'");

      
        Plotly.newPlot( iCFRCharts, [{
            x: xCordinates,
            y: yCordinates ,
            type: "line"}] );
     }
 
     }

any help would be appreciated ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source