I am trying to access self.model.get('name'), but it doesn't console.log anything. It does console log my console.log(this).
I am ultimately trying to change the name of the value fields.
Here is what I have
<code>
</code>
I am trying to access self.model.get('name'), but it doesn't console.log anything. It does console log my console.log(this).
I am ultimately trying to change the name of the value fields.
Here is what I have
<code>
</code>
Hi Amy,
this is the variable that you should use all the time.
There are often scenarios where when you're running code inside a callback, this referes to a different object, so people define another variable called "self" to refer to the previous object - So self is just a variable, and doesn't represent any in-built variable. In your case, you haven't defined self, so it's a null object, which is why your code stops at that line. You can just use this.model.get('name') instead.
Hi Amy,
this is the variable that you should use all the time.
There are often scenarios where when you're running code inside a callback, this referes to a different object, so people define another variable called "self" to refer to the previous object - So self is just a variable, and doesn't represent any in-built variable. In your case, you haven't defined self, so it's a null object, which is why your code stops at that line. You can just use this.model.get('name') instead.