refactor(upgrade/upgrade_adapter): use Deferred
helper
Making Angular 1's `$compile` asynchronous by chaining injector promises in linking functions can cause flickering views in applications.
This commit is contained in:

committed by
Victor Berchet

parent
998ce9ad7e
commit
21976446e0
@ -22,3 +22,16 @@ export function onError(e: any) {
|
||||
export function controllerKey(name: string): string {
|
||||
return '$' + name + 'Controller';
|
||||
}
|
||||
|
||||
export class Deferred<R> {
|
||||
promise: Promise<R>;
|
||||
resolve: (value?: R|PromiseLike<R>) => void;
|
||||
reject: (error?: any) => void;
|
||||
|
||||
constructor() {
|
||||
this.promise = new Promise((res, rej) => {
|
||||
this.resolve = res;
|
||||
this.reject = rej;
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user