Angular Router Get current URL Query String parameters

Angular Router Get current URL Query String parameters

Today, We want to share with you Angular Router Get current URL Query String parameters.
In this post we will show you Angularjs get current url with parameters example, hear for angular2 get query string parameters we will give you demo and example for implement.
In this post, we will learn about Angular Router: Query Parameters with an example.

READ :  Searching Sorting and Pagination in AngularJS

Simple To get all parameters from current URL with ngRoute .
means fisrt of all define all rules in angular-route.
and that you will should to main include lib. angular-route.js
in your app as a all dependency in angular-route.

Welcome to the In website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.Angularjs get current url with parameters example



<br /> AngularJS fetch current URL all parameters value and name<br />

READ :  Download Sample woocommerce products Data in CSV

simple get current url fetch string = {{urlquerystring}}

Solution of AngularJs All Problems

My First Web-Application in angularjs, So I am very happy and 1000+ more then people are used of


Fetch the current URL string without any query parameters


var urlquerystring = $location.absUrl().split(‘?’)[0]


Get part of url in angularjs


$locationProvider.html5Mode(true); //boolean true or false

function infinityknowCtrl($location){
var studId = $location.path().split(“/”)[3]||”Unknown”;
//like path will be display here /students/view/985/,
and simple generate array like display: [“”,”students”,”view”,”985″,””]


AngularJS: how can I get $location.path to template


var infinityknowApp = angular.module(‘infinityknowApp’, []); //init module

READ :  Vuejs Simple Image Slider Component - JavaScripts$rootScope, $location) {
// global $rootScope fetch
$rootScope.lqueryurlstring = $location;


Simple URL Current path fetch : {{lqueryurlstring.path()}}


Example : Get all parameters using angular ngRoute


// only add in angularjs ‘ngRoute’ lib as a dependency in your application

angular.module(‘infinityknowApp’, [‘ngRoute’]);
//config script
infinityknowApp.config(function ($routeProvider, $locationProvider)
// all configure the routing rules here with parameters
$routeProvider.when(‘/authapi/:usertype/:sid’, {
controller: ‘SalesorderCtrl’

// html enable HTML5mode boolean (true or false) to disable hashbang urls
$locationProvider.html5Mode(true); // boolean value

//controller script

infinityknowApp.controller(‘SalesorderCtrl’, function ($routeParams)
// fetch url parameters using angularjs
console.log($routeParams.sid, $routeParams.usertype);
// set and fetch api using id


demo :$location

Leave a Reply

Your email address will not be published. Required fields are marked *