on-value-updated call javascript function
-
I wondering how I can call a JS function from
on-value-updated="myFunction()"
<ma-get-point-value point="pHCD1AccelPeak" on-value-updated="testFunc('a')"></ma-get-point-value>
In my html page I have this:
<script> function myFunction () { console.log("test") } </script>
I have a value that is being updated properly but I cannot get the function to be called.
-
Because that is not how angular works.
Generally if you want to fire a function it needs to be within an angular controller. -
@mattfox Can I declare this angular controller within the HTML page im currently working on and have the function in the controller referenced a DOM element by ID?
-
No you'll have to use the userModule extension then you can create controllers in which you can then add to the HTML markup in your dashboard.
Are you familiar with how to write Angular code? If not, you will have to follow Jared Wiltshire's tutorial on how to add custom code.
https://help.infiniteautomation.com/getting-started-with-a-user-module/Once you've got that working I don't mind helping you get the bones together; then you can fill in the gaps.
Fox
-
I would also suggest searching the forum as there are many posts regarding this functionality and explanation on how to achieve this in Angular.
Here is one.
https://forum.infiniteautomation.com/topic/3639/ma-serial-chart-can-not-run/4