How to use $timeout function in Client controller to send data to server side on portal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 04:18 AM
Hi All,
I am trying to send from the client controller to the server side, I am getting the data on change of field which is a choice list on portal which is a HTML Field.
So i tried without $timeout the data is not coming properly so i am using $timeout. i have used console to check if value is correct on client side. I am getting error as "cann't read properties of undefined reading get "
c.hostname= function(){
var host;
$timeout(function(){
host=c.hostname;
this.server.get({
action: 'getvaluefromserver',;
name:host;
}).then(function(response) {
c.cloudedata=response.data.cloudpro;
console.log("data"+response.data.cloudpro)
})
}, 5000); // 5000 milliseconds = 5 seconds
}
0 REPLIES 0