angularjs ディレクティブを使用してチャートを読み込もうとしています。データがサーバーの応答から得られた後にチャートをロードしたい。しかし、スコープは空です。私のコードは
<div class="span4" ui-if="loadingIsDone">
<article id="piChart2">
<section id="toolBox1">
<h3 id="toolH1"></h3>
<p id="toolD1"></p>
</section>
<article id="toolTip1"></article>
<canvas id="canvas1" width="250" height="250" draw-chart>
</canvas>
</article>
</div>
そして私のコントローラーは
controller(){
$scope.teamStrengths = {};
$scope.loadingIsDone = false;
$http({
url: "url",
method: "POST",
data: {"userUids":uids}
}).success(function(response){
$scope.teamStrengths = response.resource.strengths;//data loads successfully
$scope.loadingIsDone = true;
//rest of code is skipped
}
そして私の指示は
Directives.directive('drawChart', function() {
return function(scope, element, attrs) {
console.debug("element :"+element);
console.debug("attrs :"+attrs);
graphDraw('canvas1',scope.teamStrengths.value1,scope.teamStrengths.value2,scope.teamStrengths.value3)
//grap loads successfully with static data
};
});
親切に私を助けてください、私は感謝します