I notice this pattern frequently
view:
<input ng-model="vm.model">
<button ng-click="vm.method(vm.model)"></button>
controller:
function Controller() {
var vm = this;
this.method = function(parameter) {
// perform actions with the model passed as parameter.
// even though it could be accessed directly by vm.model
}
}
Alternatively, this would also work :
<input ng-model="vm.model">
<button ng-click="vm.method()"></button>
Is it considered a bad practice for methods in the controller to access variables in the same scope without passing them as parameters?