I'm trying to make a directive similar to ng-model to work with file inputs. I am new to AngularDart so don't really know how to go about doing this.
Here is some code I managed to write by looking at the ng-model source files but it (obviously) doesn't work.
@Decorator(
selector: 'input[type=file][file-model]',
map: const {'file-model': '&filesSelected'})
class FileModel {
final InputElement inputElement;
String expression;
final Scope scope;
String _inputType;
List<File> files;
var filesSelected;
FileModel(this.inputElement, this.scope, NodeAttrs attrs) {
expression = attrs["file-model"];
inputElement.onChange.listen((event) {
files = inputElement.files;
filesSelected(files);
});
}
}
Any suggestions?