• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    on-value-updated call javascript function

    Scheduled Pinned Locked Moved User help
    5 Posts 3 Posters 1.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jramirez
      last edited by jramirez

      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.

      1 Reply Last reply Reply Quote 0
      • MattFoxM Offline
        MattFox
        last edited by

        Because that is not how angular works.
        Generally if you want to fire a function it needs to be within an angular controller.

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          jramirez @MattFox
          last edited by

          @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?

          1 Reply Last reply Reply Quote 0
          • MattFoxM Offline
            MattFox
            last edited by

            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

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            1 Reply Last reply Reply Quote 0
            • ThomasEinastoT Offline
              ThomasEinasto
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post