Skip to content

Commit ea92262

Browse files
Arthur AgombartArthur Agombart
authored andcommitted
chore: move dev-server to es6
1 parent 2a57d1f commit ea92262

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/dev-server.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,37 @@ import angular from 'angular';
22

33
import './input-file.component';
44

5-
function DevServerComponent($timeout) {
6-
const vm = this;
7-
vm.$onInit = () => {
8-
vm.files = [];
9-
};
5+
class DevServerComponent {
6+
constructor($timeout) {
7+
this.$timeout = $timeout;
8+
}
109

11-
vm.fileChanged = result => {
10+
$onInit() {
11+
this.files = [];
12+
}
13+
14+
fileChanged(result) {
1215
console.log('Hey !', result);
13-
vm.files.length = 0;
14-
$timeout(() => {
15-
[].push.apply(vm.files, result);
16+
this.files.length = 0;
17+
this.$timeout(() => {
18+
[].push.apply(this.files, result);
1619
});
17-
};
20+
}
21+
22+
openSelectorRegister(handler) {
23+
this._openSelector = handler;
24+
}
25+
26+
openSelector() {
27+
this._openSelector();
28+
console.log(this.aFunction);
29+
}
1830
}
1931

2032
angular.module('dev-server', [
2133
'angularjs-input-file'
2234
]).component('devServer', {
23-
controller: ['$timeout', DevServerComponent],
35+
controller: DevServerComponent,
2436
template: `
2537
<form>
2638
<label>no params</label>

0 commit comments

Comments
 (0)