简体   繁体   English

在使用Async和Asp.net Web API时,在angularJS中使用$ timeout是否重要?

[英]Is it important to use $timeout in angularJS while using Async and Await ing Asp.net Web API?

I just want to know if it is required to use $timeout in AngularJS as a synchronous way while I'm using Async and Await in my Serverside which is the Asp.Net Web Api . 我只想知道在我的服务器端(即Asp.Net Web Api使用AsyncAwait ,是否需要在AngularJS使用$timeout作为同步方式。

Please explain me and let me understand if I'm going to use $timeout , Async and Await together. 请向我解释,让我了解是否要一起使用$timeoutAsyncAwait

Async\\Await are server side operators that help you do things async in your server. Async\\Awaitserver side运算符,可帮助您在服务器中执行异步操作。

$timeout is a angularjs provider that wraps setTimeout and uses the $apply function to sync things in the angular world ( $apply calls digest ). $timeoutangularjs提供程序,它包装setTimeout并使用$apply函数来同步角度世界中的事物( $apply调用digest )。

If you are looking for a way to be async on the client side you should read about promises and deferred objects - This is the way to work async on the client (it doesn't matter if I'm async on server or not). 如果您正在寻找一种在客户async的方法,那么您应该阅读有关promisesdeferred对象的信息-这是在客户端async工作的方法(无论我是否在服务器上异步都没有关系)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM