我可以将数据绑定与三元运算符结合使用来对齐视图。
android:layout_toLeftOf=
"@{value.getUnit().equals(@string/mb)?@+id/lyt_value:@+id/lyt_value2}"
上面的代码给出了编译错误“ expr有望”
答案 0 :(得分:0)
尝试一下:
attachmentToken: string;
public submitForm(finalData) {
const { attachment, ...data } = finalData;
return !this.attachmentToken ? this.attachmentCall(attachment, data) : this.formDataCall(finalData);
}
attachementCall(attachment, data) {
this.http
// at first get attachment's token
.post('/attachments', attachment)
.pipe(
switchMap((attachmentToken) => {
const formData = {
data,
attachment: attachmentToken
};
this.attachmentToken = attachmentToken;
// submit form data
return this.formDataCall(formData);
}),
);
}
formDataCall() {
return this.http.post('/submitformdata', formData);
}