I'm having trouble with some basic angular databinding.
my view:
<select
ng-model=selectedPerson
ng-options=person.name for person in testdataset
ng-change=personChanged(selectedPerson)>
<option value=>All Persons</option>
</select>
my controller:
$scope.testdataset = [
{name:bill},
{name:bob},
{name:batman}
];
$scope.personChanged = function(person) {
console.log(person);
}
This works great--selected name is logged.
But this simply prints undefined when a name is selected
view:
<select
ng-model=selectedPerson
ng-options=person.name for person in testdataset
ng-change=personChanged()>
<option value=>All Persons</option>
</select>
controller:
$scope.testdataset = [
{name:bill},
{name:bob},
{name:batman}
];
$scope.personChanged = function() {
console.log($scope.selectedPerson);
}
I'm new to angular, and I'm just perplexed. I'm assuming it's got to do with the, er, scope of $scope inside the function, but I'm not sure how to troubleshoot...