Passing Parameters to Angular CLI

Issue

I have an angular application that lunches from another asp.net applicatin.
my questions :

example( asp.net application will send the following url to my angular application

http://example.com?id=1&user=“john M”

  1. how my Angular CLI application can get/read the above parameters.
  2. how my Angular CLI application can verify the referral URL.

Solution

To be clear on the terminology, the Angular CLI is a command line tool that you use to create an Angular application, generate code for that application, execute tests, and build. I assume you mean an Angular application and not that you are sending this command to the Angular CLI.

I assume you will be able to perform the routing and read the parameters just like if the user typed in the URL. You can read about Angular routing here: https://angular.io/guide/router

Here is a snippet showing how to read in query parameters using the router:

    this.id= this.route.snapshot.queryParamMap.get('id');
    this.user= this.route.snapshot.queryParamMap.get('user');

Answered By – DeborahK

Answer Checked By – Dawn Plyler (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.