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:
Peter Bacon Darwin
2016-11-03 14:48:11 +00:00
committed by Victor Berchet
parent 998ce9ad7e
commit 21976446e0
2 changed files with 59 additions and 48 deletions

View File

@ -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;
});
}
}