After the last one, a simple method of GetByID, the most commonly used is the method.
Directly on the code:
getbyId (id:string) { This. Myhttp.get (' http://192.168.2.139:9002/api/patients/' +ID). Subscribe (Data= { This. mypatient =NewPatient ({id:data[' Patientid '], firstname:data[' Details ']. FirstName, lastname:data[' Details ']. LastName, middlename:data[' Details ']. MiddleName, birthdate:data[' Details ']. BirthDate, gender:data[' Details ']. Gender, phonenumber:data[' Personalinfo ']. Phonenumberprimary, zipcode:data[' Personalinfo ']. ZIPCODE, city:data[' Personalinfo ']. City, street:data[' Personalinfo ']. Street, emailaddress:data[' Personalinfo ']. Emailaddressprimary, citizenservicenumber:data[' Personalinfo ']. Servicenumber}); }); }
Front desk:
<Div> <Button(click)= "getbyId (' a6c804e8-daef-42fb-8cd2-c56a02540d2c ')">Getbyid:a6c804e8</Button> <Div*ngif=mypatient> <ul> <Li>Id:{{mypatient.id}}</Li> <Li>FirstName: {{mypatient.firstname}}</Li> <Li>Email:{{mypatient.emailaddress}}</Li> </ul> </Div> </Div>
Show Results:
Other methods, to be continued ...
Angular HttpClient GetByID method to get data