Created
June 7, 2018 05:28
-
-
Save huangzhuolin/f86224a0d7051d73663911cb65d77f5f to your computer and use it in GitHub Desktop.
[access search parameters(or $routeParams) in controller with `$inject`] #angularjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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