Skip to content

Instantly share code, notes, and snippets.

@huangzhuolin
Created June 7, 2018 05:28
Show Gist options
  • Save huangzhuolin/f86224a0d7051d73663911cb65d77f5f to your computer and use it in GitHub Desktop.
Save huangzhuolin/f86224a0d7051d73663911cb65d77f5f to your computer and use it in GitHub Desktop.
[access search parameters(or $routeParams) in controller with `$inject`] #angularjs
constructor($scope, $injector) {
this.$injector = $injector;
this.$scope = $scope;
// ...
// access url params
someFunc(){
const routeParams = this.$injector.get("$routeParams");
const searchParams = this.$injector.get("$location").search();
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment