Код: Выделить всё
Textbox1 Textbox2
tagid= '103', Typename= 'Store keeping',
< /code>
customercomponent.ts
onClick2(event: MouseEvent, data: any) {
this.router.navigate(['/details'], { queryParams: { tagid: data.TagId, typename: data.Typename}
});
< /code>
detailscomponent.ts
public typename: string;
public tagid: string;
ngOnInit() {
this.route.queryParams.subscribe((params) => {
this.tagid = params['tagid'];
this.typename= params['typename'];
});
}
onSubmit(form: NgForm){
this.service.formSubmitted = true;
//appetite
if (form.valid) {
this.service.postappetite()
.subscribe({next: res => {
console.log(res);
this.toastr.success('Saved Successful');
},
error: err => {console.log(err)}
})
}
else {
this.toastr.error('Please Enter Your Data ');
}
}
< /code>
Подробности html < /p>
Save
< /code>
service.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { DataMeasure} from './data-model';
@Injectable({
providedIn: 'root'})
export class MeasurelService {
public typename: string;
public tagid: string;
constructor(private http:HttpClient) { }
formappetite:DataMeasure = new DataMeasure();
formSubmitted: boolean = false;
readonly baseurlanimal = 'api/InventoryAPI'
postappetite(tagno: string, animal: string){
return this.http.post(this.baseurlanimal, this.formappetite);
}
}
TagId
Typename
101 < /td>
dairy < /td>
< /tr>
102 < /td>
sales < /td>
< /tr>
< /tbody>
< /td>
< /tr>
< /tbody> < /> < /td>
< /tr>
< /tbody>>
Подробнее здесь: https://stackoverflow.com/questions/795 ... o-database