2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > angular中http请求和传值

angular中http请求和传值

时间:2022-02-07 15:34:43

相关推荐

angular中http请求和传值

有关angular传值的相关内容

<number-info[subTitle]="customTitle"[total]="item.ENERGY_RATE + '%'"[subTotal]="item.ENERGY_RATE_DIFF + '%'"[status]="item.ENERGY_RATE_DIFF >= 0 ? 'up' : 'down'">

在number-info上面,会是一个@delon/chart的类库,可以在NG-ALAIN上找到阅读NG ALAIN的图表了解到subtitle可以绑定一些template属性,可以在里面放一些东西,比如按钮

<ng-template #customTitle>泵效率<buttonnz-button[nzType]="default"nzShape="circle"nz-tooltipnzTooltipTitle="修改传动系数"(click)="openModal(item)">

这个customTitle就是一个前一段代码中 [subTitle]="customTitle"subtitle绑定的template

这里刚开始把template放在了这个#board界面外面,但是有一些item的值没有传出去,这里不展开讲了…

<nz-modal#modalq[nzStyle]="{ top: '45px' }"[nzVisible]="false"nzWidth="600px"(nzOnCancel)="close()"[nzBodyStyle]="{ height: '200px' }"[nzTitle]="editTitle"[nzFooter]="null"><sf *nzModalContent #sfRef [schema]="transRateSchema" [formData]="updateItem" mode="edit" button="none"><div class="modal-footer"><button nz-button type="button" [nzType]="'primary'" (click)="close()">关闭</button><button nz-button type="submit" [nzType]="'primary'" (click)="updateData(sfRef.value)" [nzLoading]="http.loading">保存</button></div></sf></nz-modal>

item的类型应为any,sf之类的输入的值则为STDATE,比如这里的(click)=“updateData(sfRef.value)”

const request = new PageRequest();

request.PageCondition.PageSize = 5;

request.FilterGroup.Rules.push(new FilterRule(‘READ_FLAG’, ‘0’, FilterOperate.Equal));

这段代码用来read,因为先查看apiservice

openModal(item: any): void {this.editmodalq.open();const request = new PageRequest();request.PageCondition.PageSize = 0;request.FilterGroup.Rules.push(new FilterRule('PUMP_CODE', item.PUMP_CODE, FilterOperate.Equal));const url = 'api/DWPump/Setting/HT_PUMP_CON/read';this.http.post(url, request).subscribe(result => {this.updateItem = result.Rows[0];});}

updateData(updatedItem: STData) {const url = 'api/DWPump/Setting/HT_PUMP_CON/update';this.http.post(url, [updatedItem]).subscribe(result => {this.osharp.ajaxResult(result, () => {this.getData();});});}

他有一个pagerequest请求const request = new PageRequest();

也就是必须得是request才能传输过去

this.updateItem = result.Rows[0];updateItem是一个any类型数组:

updateItem: any = {};

由于有[formData]="updateItem"所以值被绑定在前面的表单中了,所以使用http请求的时候能够传递过去

通过这个angular的值传递项目,我深刻了解了angular的项目内容

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
angular http请求

angular http请求

2018-08-12

ANGULAR $HTTP请求

ANGULAR $HTTP请求

2024-05-16

Angular配置http请求

Angular配置http请求

2024-03-28

angular 取消http请求

angular 取消http请求

2021-04-03