在Angular 8 中,ɵBrowserPlatformLocation
已被删除。如果你的代码中使用了这个成员,你需要更新代码来使用新的替代方法。
以下是一个解决方法的示例:
打开你的代码中使用了 ɵBrowserPlatformLocation
的文件。
导入 Location
服务,替代 ɵBrowserPlatformLocation
。
import { Location } from '@angular/common';
ɵBrowserPlatformLocation
的实例更改为 Location
的实例。constructor(private location: Location) { }
Location
的方法来执行相应的操作,例如使用 path()
来获取当前路径。const currentPath = this.location.path();
ɵBrowserPlatformLocation
的地方,重复步骤 3 和步骤 4。这样,你就更新了使用了 ɵBrowserPlatformLocation
的代码,使它在 Angular 8 中正常运行。