File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,14 @@ import './input-file.component';
5
5
class DevServerComponent {
6
6
constructor ( $timeout ) {
7
7
this . $timeout = $timeout ;
8
- }
9
-
10
- $onInit ( ) {
11
8
this . files = [ ] ;
9
+
10
+ this . fileChangedBind = result => this . fileChanged ( result ) ;
12
11
}
13
12
14
13
fileChanged ( result ) {
15
- console . log ( 'Hey !' , result ) ;
16
- this . files . length = 0 ;
17
14
this . $timeout ( ( ) => {
18
- [ ] . push . apply ( this . files , result ) ;
15
+ this . files = result ;
19
16
} ) ;
20
17
}
21
18
@@ -52,24 +49,29 @@ angular.module('dev-server', [
52
49
</form>
53
50
<form>
54
51
<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>
56
54
</form>
57
55
<form>
58
56
<label>ngChange - Base64</label>
59
- <input-file files-loaded="$ctrl.fileChanged "
57
+ <input-file files-loaded="$ctrl.fileChangedBind "
60
58
file-format="Base64">
61
59
</input-file>
62
60
</form>
63
61
<form>
64
62
<label>ngChange - Text</label>
65
- <input-file files-loaded="$ctrl.fileChanged "
63
+ <input-file files-loaded="$ctrl.fileChangedBind "
66
64
file-format="Text">
67
65
</input-file>
68
66
</form>
69
67
70
68
<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>
73
75
</div>
74
76
75
77
<button ng-click="$ctrl.openSelector()">Button opening the file selector dialog from the first input-file</button>
You can’t perform that action at this time.
0 commit comments