File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 198198 return {
199199 scope : scope ,
200200 link : function ( scope , element , attrs ) {
201- function updateData ( key , data ) {
202- if ( key ) {
203- scope . datasourceDt . key = data ;
204- chart . setJSONData ( scope . datasourceDt ) ;
205- }
201+ function updateData ( ) {
202+ // no need to check for key. datasourceDt is 2 way binded.
203+ // also scope.datasourceDt.key = data; is logically wrong.
204+ chart . setJSONData ( scope . datasourceDt ) ;
206205 }
207206
208207 function createWatchersForAttrs ( datasource ) {
212211 scope . $watch (
213212 'datasourceDt.' + key ,
214213 function ( newData , oldData ) {
215- if ( newData !== oldData && isDeep ) updateData ( key , newData ) ;
214+ if ( newData !== oldData && isDeep ) updateData ( ) ;
216215 } ,
217216 isDeep
218217 ) ;
747746 scope . $watch (
748747 'datasourceDt.data' ,
749748 function ( newData , oldData ) {
750- if ( newData !== oldData ) updateData ( newData , 'data' ) ;
749+ if ( newData !== oldData ) updateData ( ) ;
751750 } ,
752751 false
753752 ) ;
754753 createWatchersForAttrs ( scope . datasourceDt ) ;
754+ // set the data anyway, initially.
755+ chart . setJSONData ( scope . datasourceDt ) ;
755756 } else if ( scope . datasourceDt ) {
756757 attrs . datasourceDt = scope . datasourceDt ;
757758 chartConfigObject . dataSource = scope . datasourceDt ;
You can’t perform that action at this time.
0 commit comments