Angular: Fixing some annoying depreaction warnings (#36466)

This commit is contained in:
Torkel Ödegaard
2021-07-07 18:39:10 +02:00
committed by GitHub
parent a86ad1190c
commit 96a51561a3
2 changed files with 11 additions and 6 deletions
+8 -4
View File
@@ -18,10 +18,14 @@ export class AngularLocationWrapper {
this.url = this.wrapInDeprecationWarning(this.url);
}
wrapInDeprecationWarning = (fn: Function, replacement?: string) => {
deprecationWarning('$location', fn.name, replacement || 'locationService');
return fn.bind(this);
};
wrapInDeprecationWarning(fn: Function, replacement?: string) {
let self = this;
return function wrapper() {
deprecationWarning('$location', fn.name, replacement || 'locationService');
return fn.apply(self, arguments);
};
}
absUrl(): string {
return `${window.location.origin}${this.url()}`;