Skip to content

Commit fe5b124

Browse files
Arthur AgombartArthur Agombart
authored andcommitted
chore: more test case
1 parent 8c1bf19 commit fe5b124

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/dev-server.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ import './input-file.component';
55
class DevServerComponent {
66
constructor($timeout) {
77
this.$timeout = $timeout;
8-
}
9-
10-
$onInit() {
118
this.files = [];
9+
10+
this.fileChangedBind = result => this.fileChanged(result);
1211
}
1312

1413
fileChanged(result) {
15-
console.log('Hey !', result);
16-
this.files.length = 0;
1714
this.$timeout(() => {
18-
[].push.apply(this.files, result);
15+
this.files = result;
1916
});
2017
}
2118

@@ -52,24 +49,29 @@ angular.module('dev-server', [
5249
</form>
5350
<form>
5451
<label>ngChange - Default</label>
55-
<input-file files-loaded="$ctrl.fileChanged"></input-file>
52+
<input-file files-loaded="$ctrl.fileChangedBind"
53+
multiple="true"></input-file>
5654
</form>
5755
<form>
5856
<label>ngChange - Base64</label>
59-
<input-file files-loaded="$ctrl.fileChanged"
57+
<input-file files-loaded="$ctrl.fileChangedBind"
6058
file-format="Base64">
6159
</input-file>
6260
</form>
6361
<form>
6462
<label>ngChange - Text</label>
65-
<input-file files-loaded="$ctrl.fileChanged"
63+
<input-file files-loaded="$ctrl.fileChangedBind"
6664
file-format="Text">
6765
</input-file>
6866
</form>
6967
7068
<div>
71-
<h3>Result:</h3>
72-
<pre>{{ $ctrl.files | json }}</pre>
69+
<h3>Result: {{ $ctrl.files && $ctrl.files.length }}</h3>
70+
<ul>
71+
<li ng-repeat="file in $ctrl.files">
72+
<pre ng-bind="file.infos && file.infos.name || file.name"></pre>
73+
</li>
74+
</ul>
7375
</div>
7476
7577
<button ng-click="$ctrl.openSelector()">Button opening the file selector dialog from the first input-file</button>

0 commit comments

Comments
 (0)