Angular location redirect with parameters

Angular location redirect with parameters

Today, We want to share with you Angular location redirect with parameters.
In this post we will show you Angular location redirect with parameters, hear for Angular location redirect with parameters we will give you demo and example for implement.
In this post, we will learn about Angular location redirect with parameters with an example.

AngularJS supports The (SPA) using routing module to ngRoute.and This routing module (spa)simple acts based on the url.

AngularJS routes all pages enable you to create different URLs for different content display in your web-application.

AngularJS routes module can be used to show different page content in an AngularJS web-app based on the different part of the page URL after the # sign (the route),and practically content enabling bookmarkable all links into your AngularJS web-application.

READ :  Angular 6 Tutorial with Top 10 Examples

AngularJS routes web app that loads a single HTML page(spa) and dynamically all updates that page as the user interacts with the web application.

$location.path('/myURL/').search({param: 'value'});

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

config(['$routeProvider', function ($routeProvider) {
	$routeProvider.when('/login/:parameterval1', {
		templateUrl: '',
		controller: productCtrl

Fetch parameters value

The parametervalue can then be accessed in productCtrl as follows:

var fetchvar= $routeParams.parameterval1;

Route Parameters


<a href="#/about/abcd">About Us + param</a><br />
<a href="#/contact/1234">Contact Us + param</a><br />


    var infinityknowApp = angular.module("mr4App", ['ngRoute']);

        function($routeProvider) {
                    when('/about/:param', {
                        templateUrl: 'about-us.html',
                        controller: 'AboutController'
                    when('/contact/:param', {
                        templateUrl: 'contactus.html',
                        controller: 'ContactController'
                        redirectTo: '/'

    infinityknowApp.controller("AboutController", function($scope, $routeParams) {
        $scope.param_val = $routeParams.param;


<h3>Creating a default route</h3>
<p>Routing in AngularJS also supports the facility to have a default route. in config. </p>
otherwise ({
    redirectTo: '/angular'

<h3>When the app loads</h3> 
[php] ($location, appAuth) {  
	//check auth.
  if (!appAuth.isLoggedIn()) {
	//redirect login page

View Demo

READ :  Dynamically Loading Controllers in angularjs