I am trying to fetch email id value from text box and want to send it in api method in cs file. But it is not working, I have tried below code..can any one help me.
Value is successfully coming in service file, I have alert that but not going in cs file.
I am using Angular in front end and .Net core in backend API. Also this is Aspnetzero project.
First of all below is register.component.html file code :
<div class="form-group">
                <input #emailAddressInput="ngModel" 
                       placeholder="{{'EmailAddress' | localize}} *" 
                    [(ngModel)]="model.emailAddress" name="EmailAddress" required maxlength="256"/>
            </div>
            <div class="pb-lg-0 pb-5">
                <button type="button" class="btn btn-primary blue float-right"
                 (click)="checkUserExist(model.emailAddress)">Continue</button>
            </div>
Below is code from register.component.ts file
checkUserExist(emailid): void {
        this._accountService.registerHostLevelUser(emailid).subscribe((result) => {
            alert(result);
        });
    }
Below is code of my function in service-proxies.ts file.
registerHostLevelUser(value:any){
        let url_ = this.baseUrl + "/api/services/app/Account/RegisterHostLevelUser";
        url_ = url_.replace(/[?&]$/, "");
        return this.http.post(url_,value);
      }
Below is code from AccountAppServices.cs file
 public async Task<string> RegisterHostLevelUser(string value)
        {
            Debug.WriteLine(value); // here i am trying to write value but it is alwasy coming null.
            return "Done";
        }
				
                        
On post methods the controller expects a JSON object to be passed as parameter, you are trying to bind a single string, wich is not working because a string is not a JSON object.
Try this:
and change this part as well
As well you can build and object with a single string property and pass the object as parameter as an JSON body to your controller, but the way above its more pratical.