0

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.
rgoal
  • 1,236
  • 11
  • 35
  • 61

1 Answers1

1

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');
DeborahK
  • 57,520
  • 12
  • 104
  • 129
  • Thanks DeborahK, Yes, CLI is just a command line..the confusion I have is when navigating from within an application I do use " { path: ':id/:name', component: SearchComponent }" then in my component I do this._rout.params.subscribe(params => { this.dashboardStatusID = params['id']; this.dashboardSatusName = params['name']; }); – rgoal Jul 30 '18 at 22:09
  • That is the code for required parameters, which have a different syntax from query parameters. See this link for a description of the difference between required and query parameters: https://stackoverflow.com/questions/44864303/send-data-through-routing-paths-in-angular/44865817#44865817 – DeborahK Jul 30 '18 at 22:14