利用AngularJS框架實踐各種設計模式:AngularJS in Patterns。
利用AngularJS框架實踐各種設計模式:AngularJS in Patterns。
Proxy
A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate.
We can distinguish three different types of proxy:
- Virtual Proxy
- Remote Proxy
- Protection Proxy
In this sub-chapter we are going to take a look at AngularJS' implementation of Virtual Proxy.
In the snippet bellow, there is a call to the get
method of $resource
instance, called User
:
var User = $resource('/users/:id'), user = User.get({ id: 42 }); console.log(user); //{}
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!