No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Error in call back for watcher, method is not a function

    Framework
    2
    4
    1090
    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.
    • E
      eugenemaning last edited by

      I’m trying to use the watchers as referenced here , however the method call I invoked inside the watcher is not recognized as a function.

      I basically followed the guide. Any thoughts? Thank you.

      1 Reply Last reply Reply Quote 0
      • benoitranque
        benoitranque last edited by benoitranque

        This is not quasar specific, and it would help if you could post your code so we can tell you what is wrong. This should work fine:

        <q-input v-model="message"/> 
        
        data () {
          return {
            message: ''
          }
        },
        methods: {
          messageChanged () {
            console.log(this.message)
          }
        },
        watch: {
          message () {
            this.messageChanged()
          }
        }
        
        1 Reply Last reply Reply Quote 0
        • E
          eugenemaning last edited by

          My case has been answer at SO. Thank you very much. https://stackoverflow.com/questions/47670499/quasar-framework-method-inside-watcher-is-not-recognized

          1 Reply Last reply Reply Quote 0
          • benoitranque
            benoitranque last edited by

            You issue seems to have been the binding of this due to improper use of arrow functions.

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