I need help finding the query string value for the URL www.example.com/product?id=23
This is the code I am using:
let myApp = angular.module('myApp', []);
myApp.controller('test', ['$scope', '$location', '$http', function ($scope, $location, $http) {
alert($location.search()['id']);
}]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js"></script>
<div app="myApp" controller="test">
</div>
For example, I would like to retrieve the id value of 23.
How can this be achieved?
Referencing this link.