If you are using $location service in your old AngularJS application, now you can use LocationUpgradeModule(unified location service) which puts the responsibilities of $location service to Location service in Angular. Let’s add this module to AppModule as below,
1 2 3 4 5 6 7 8 9 10 | // Other imports ... import { LocationUpgradeModule } from '@angular/common/upgrade'; @NgModule({ imports: [ // Other NgModule imports... LocationUpgradeModule.config() ] }) export class AppModule {} |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.