javascript - Angular $watch doesn't get triggered -


I am trying to write a instructions for drawing barcharts, and I want to repeat the data every time from the chart Are the changes I currently have this:

  / * This instruction will create a bar chart based on the datatable * It expects the label in the first column of the data table to be included. * If more than 2 columns (labels have more than one value) are supplied, * All bars generated from values ​​in one line will be grouped together, * An easy visual comparison (benchmark). * If the option overlay is supplied, weird price columns will be created (with the [x [label, cola 1, cola 2, to 3, to 4] with the [below] * result with call 1 and call 3 * (* 'Window', '$ location', '$ parse', '$ timeout', function ($ window, '$'), and 'col4 * / angular.module' ('kapstok' $ Location, $ parse, $ timeout) {return: Restrict: 'E', Scope: true, link: function (scope, elm, ethers) {// read all different parameters in the DIRECTIVITY declaration GEVIEN If options are not given, they are replaced by their default values. Var Datagator = $ paras (attrs.data); var data = datagram (scope); undefined; if (! Data) { Throw error ("No (legitimate) data source specified!");} // Once the table has been updated, redo on the table. However, usually several elements of the table // will be updated at the same time, while the clock Will be triggered // on every update To stop, we give it an end of half a second, allowing // to apply all updates before the table is ready again. Radius $ Watch (function () {return data.getVersion ();}, $ timeout (draw chart, 500));  

Then, in my controller I do:

  controlmodule.controller ('PrefscanController', ['$ http', '$ scope', ' $ Scope.myData.addColumn ("string", "label"); $ scope.myData.addColumn ("number", "dataTable", function ($ http, $ scope, dataTable) {$ scope.myData = new datatale () $ Scope.myData.addColumn ("number", "break-it"); $ scope.myData.addRow (['test', 20, 10, 4]); $ scope.myData.addRow (['test2' , 42, 13, 2]); $ scope.hideBenchmark = function () {console.log ("myData.version =", $ Scope.myData.getVersion ()); $ scope.myData.hideColumn (2); console .log ("myData.version =", $ scope.myData.getVersion ());}  

In all the functions from the datatable, whenever something changes, the one called 'version' Property b I need $ Watch to see me.

In my template then I have a button, an NG-click which calls the hide-in benchmark function. This function is said by GE T The datatable version has been updated, but whichever I try, the clock will not be triggered.

I have $ scope. $ Appy () / $ scope To hide the $ digest () benchmark function, try to make the clock 'true' (in search of inequality object), tried attr.d '', 'data.version' and any of the clock Begin to trigger! I know that I can make another variable, and I change the data every time I change the data on the free radius from this data, but it seems ugly and unnecessary.

Does anyone know why the clock is not starting, and what do I want to do for it?

Regards,

Linus

    

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -