I have code like this in my app:
observers: [
'_dataGenericObserver(userData.generic)',
],
// NOT visible. In this case, the selected tab mustn't be "register"...
_dataGenericObserver: function(){
this.selected = 'login';
} else {
if (this.defaultRegister) {
this.selected = 'register';
} else {
this.selected = 'login';
}
}
},
Is this safe? Or should I *always* do this instead:
observers: [
'_dataGenericObserver(userData.generic)',
],
// NOT visible. In this case, the selected tab mustn't be "register"...
_dataGenericObserver: function(generic){
this.selected = 'login';
} else {
if (this.defaultRegister) {
this.selected = 'register';
} else {
this.selected = 'login';
}
}
},
...?
I noticed in some cases in other parts of the app that if I have an observer on `_someFunc(value.subvalue)`, and then have `_someFunc: function( subValue)`, in the function `subValue` is set, whereas `this.value.subValue` isn't. However, I am not able to replicate it - sorry.
Questions:
* Is it always recommended to use the values passed to the functions, rather than `this.*`?
* WHEN is it likely to happen, that a `subValue` is set as a function parameter, but NOT in `this.value.subValue`?