@@ -32,14 +32,6 @@ export class FileComponent implements OnDestroy {
32
32
dragoverflag : boolean = false ;
33
33
34
34
constructor ( private zone : NgZone ) {
35
- window [ 'angularComponentRef' ] = {
36
- zone : this . zone ,
37
- traverseFileTree : ( item , path ) => this . traverseFileTree ( item , path ) ,
38
- addToQueue : ( item ) => this . addToQueue ( item ) ,
39
- pushToStack : ( str ) => this . pushToStack ( str ) ,
40
- popToStack : ( ) => this . popToStack ( ) ,
41
- component : this
42
- } ;
43
35
if ( ! this . customstyle ) {
44
36
this . customstyle = 'drop-zone' ;
45
37
}
@@ -123,33 +115,34 @@ export class FileComponent implements OnDestroy {
123
115
if ( item . isFile ) {
124
116
const toUpload : UploadFile = new UploadFile ( path , item ) ;
125
117
this . files . push ( toUpload ) ;
126
- window [ 'angularComponentRef' ] . zone . run ( ( ) => {
127
- window [ 'angularComponentRef' ] . popToStack ( ) ;
118
+ this . zone . run ( ( ) => {
119
+ this . popToStack ( ) ;
128
120
} ) ;
129
121
} else {
130
122
this . pushToStack ( path ) ;
131
123
path = path + '/' ;
132
124
const dirReader = item . createReader ( ) ;
133
125
let entries = [ ] ;
126
+ const thisObj = this ;
134
127
135
128
const readEntries = function ( ) {
136
129
dirReader . readEntries ( function ( res ) {
137
130
if ( ! res . length ) {
138
131
// add empty folders
139
132
if ( entries . length === 0 ) {
140
133
const toUpload : UploadFile = new UploadFile ( path , item ) ;
141
- window [ 'angularComponentRef' ] . zone . run ( ( ) => {
142
- window [ 'angularComponentRef' ] . addToQueue ( toUpload ) ;
134
+ thisObj . zone . run ( ( ) => {
135
+ thisObj . addToQueue ( toUpload ) ;
143
136
} ) ;
144
137
} else {
145
138
for ( let i = 0 ; i < entries . length ; i ++ ) {
146
- window [ 'angularComponentRef' ] . zone . run ( ( ) => {
147
- window [ 'angularComponentRef' ] . traverseFileTree ( entries [ i ] , path + entries [ i ] . name ) ;
139
+ thisObj . zone . run ( ( ) => {
140
+ thisObj . traverseFileTree ( entries [ i ] , path + entries [ i ] . name ) ;
148
141
} ) ;
149
142
}
150
143
}
151
- window [ 'angularComponentRef' ] . zone . run ( ( ) => {
152
- window [ 'angularComponentRef' ] . popToStack ( ) ;
144
+ thisObj . zone . run ( ( ) => {
145
+ thisObj . popToStack ( ) ;
153
146
} ) ;
154
147
} else {
155
148
// continue with the reading
0 commit comments