<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ngChange-directive-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
</head>
<body ng-app="changeExample">
<script>
angular.module('changeExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.fileChanged = function(files) {
console.log('files', files);
};
}]);
</script>
<div ng-controller="ExampleController">
ng-change does not work with type="file" <br/>
<input type="file" name='file' ng-change="fileChanged()" /> <br/>
Insead use onchange="angular.element(this).scope().fileChanged()"
<input type="file" onchange="angular.element(this).scope().fileChanged(this.files)" />
{{file}}
</div>
</body>
</html>
var counter = element(by.binding('counter'));
var debug = element(by.binding('confirmed'));
it('should evaluate the expression if changing from view', function() {
expect(counter.getText()).toContain('0');
element(by.id('ng-change-example1')).click();
expect(counter.getText()).toContain('1');
expect(debug.getText()).toContain('true');
});
it('should not evaluate the expression if changing from model', function() {
element(by.id('ng-change-example2')).click();
expect(counter.getText()).toContain('0');
expect(debug.getText()).toContain('true');
});