forgive me, WEB Xiaobai, to ask a simple question
- the front end is implemented using Angular6 + antd, and the back end uses the java
front end to add data to the grid component as a pop-up antd modal form. The content part of the modal form (nzContent)
uses a custom component, in which an input is used to input to the user the following code for the custom component (where only the forms function of angular is used, not the function of antd):
<form [formGroup]="unit" (ngSubmit)="goSubmit()">
<div>:<input type="text" formControlName="sid"></div>
<button type="submit"></button>
</form>
two buttons appear in the footer section in the modal form that uses antd, pop-up:
the name of input in the form above is sid, the pulibc property of the model class in java is also sid
, but the model class in java has other public attributes, and there is only one sid attribute
(this should not affect it)
the code to send the request in the ts file of
angular is:
goSubmit(){
console.log("angular:");
console.log(this.unit.value);
var reqUrl = "http://localhost:8085/femis/unitUpdateByPrimaryKey";
this.http.post(reqUrl,this.unit.value)
.subscribe(
val=>{
console.log("");
},
error=>{
console.log(":" + error);
},
()=>{ console.log("anyway"); }
);
}
Click the button "submitted", and the java of the backend that the request was sent successfully is in. Here is the java code:
@PostMapping("/unitUpdateByPrimaryKey")
public String updateByPrimaryKey(@ModelAttribute Unit unit) {
System.out.println(":/unitUpdateByPrimaryKey");
System.out.println(":" + unit.toString());
return "";
}
then print out in the console of Eclipse:
:/unitUpdateByPrimaryKey
:Unit [sid=null, serialno=null, status=null, createdate=null, createcomputer=null, createuser=null]
- my doubt:
the value on the front-end input is not passed to the back-end?
the whole process did not report an error, but the backend just did not receive the data. How to solve this problem?
has been bothering, thanks for any helpbacks for two days! - my contact information:
409223171@qq.com
QQ ditto, Wechat ditto