My situation is as follows:
directive
scope: { foo:'=' },
template: '<input type="checkbox" ng-model="foo"/>'
parent controller
$scope.foo = false;
jasmine test
var cb = iElement.find('input');
$timeout(function() { // using $timeout to ensure $digest() isn't the issue.
cb.prop('checked',!cb.prop('checked'))
},0);
expect(cb.prop('checked')).toBe(true); // passes
expect($scope.foo).toBe(true); // doesn't pass
My question: why doesn't $scope.foo get updated when I issue the prop('checked') even though the DOM does (as I've verified after inspecting it).
Here is a jsbin that roughly demonstrates the problem http://jsbin.com/kapifezi/2/edit