How to integrate Google charts as an AngularJs directive?

前端 未结 4 1861
一生所求
一生所求 2021-02-01 05:36

There are some examples of integrating Google charts as an AngularJs directive.

Like this one: http://plnkr.co/edit/YzwjuU?p=preview

Update: I w

4条回答
  •  误落风尘
    2021-02-01 06:19

    As you already figured out, you can initialize angular in the html or body tag, without waiting for google charts.

    To ensure you don't try to render a chart before the google chart JavaScript code is ready, I would have the directive $watch a new controller $scope property/flag that you set inside the callback function for google.setOnLoadCallback. Inside the $watch callback, check to ensure the flag is set, then do your initialization.

提交回复
热议问题