I have following function
add(playload) {
return this.http.post(`/api/v1/cards.json`, { text: trim(playload) });
}
It output following.
error TS2304: Cannot find name 'trim'.
How can I solve this error?
The syntax of using trim
is string.trim()
where string
is any string value in which you want to trim the whitespaces. So. you need to use payload.trim()
like this, (and not trim(payload)
)
add(playload) {
return this.http.post(`/api/v1/cards.json`, { text: playload.trim() });
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.