File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 198
198
return {
199
199
scope : scope ,
200
200
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 ) ;
206
205
}
207
206
208
207
function createWatchersForAttrs ( datasource ) {
212
211
scope . $watch (
213
212
'datasourceDt.' + key ,
214
213
function ( newData , oldData ) {
215
- if ( newData !== oldData && isDeep ) updateData ( key , newData ) ;
214
+ if ( newData !== oldData && isDeep ) updateData ( ) ;
216
215
} ,
217
216
isDeep
218
217
) ;
747
746
scope . $watch (
748
747
'datasourceDt.data' ,
749
748
function ( newData , oldData ) {
750
- if ( newData !== oldData ) updateData ( newData , 'data' ) ;
749
+ if ( newData !== oldData ) updateData ( ) ;
751
750
} ,
752
751
false
753
752
) ;
You can’t perform that action at this time.
0 commit comments