利用AngularJS框架實踐各種設計模式:AngularJS in Patterns。

jopen 10年前發布 | 36K 次閱讀 Web框架 AngularJS in Patterns angularjs

利用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.

利用AngularJS框架實踐各種設計模式:AngularJS in Patterns。

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); //{}

項目主頁:http://www.baiduhome.net/lib/view/home/1417078387627

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!