diff options
| author | Misko Hevery | 2010-07-22 11:18:32 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-07-22 11:18:32 -0700 | 
| commit | 849a05b5a578f19ddc3d24dc9fbd304e0e07612a (patch) | |
| tree | 3e32e2ab7b8c1ed3f53e5b568990070b5edab4fa /example | |
| parent | b5bbfaeb80c3f89c65d14c72cff6f0e1c8aa497a (diff) | |
| download | angular.js-849a05b5a578f19ddc3d24dc9fbd304e0e07612a.tar.bz2 | |
added jsonp to resources
Diffstat (limited to 'example')
| -rw-r--r-- | example/buzz/buzz.css | 0 | ||||
| -rw-r--r-- | example/buzz/buzz.html | 30 | ||||
| -rw-r--r-- | example/buzz/buzz.js | 19 | 
3 files changed, 49 insertions, 0 deletions
| diff --git a/example/buzz/buzz.css b/example/buzz/buzz.css new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/example/buzz/buzz.css diff --git a/example/buzz/buzz.html b/example/buzz/buzz.html new file mode 100644 index 00000000..ee2b2bb9 --- /dev/null +++ b/example/buzz/buzz.html @@ -0,0 +1,30 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html xmlns:ng="http://angularjs.org"> +  <head> +    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> +    <script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script> +    <script type="text/javascript" src="buzz.js"></script> +    <link rel="stylesheet" type="text/css" href="style.css"/> +  </head> +  <body ng:init="$window.$root = this" ng:controller="BuzzController"> +  <div class="bar"> +    <input type="text" name="userId"/> +    <button ng:click="$location.hashPath = userId">fetch</button> +  </div> +  <ul> +    <li ng:repeat="item in activities.data.items"> +      <img src="{{item.actor.thumbnailUrl}}"/> +      <a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a> +      {{item.object.content | html}} +      <a href="">Replies: {{item.links.replies[0].count}}</a> +      <ul> +        <li ng:repeat="reply in item.replies.items"> +          <img src="{{reply.actor.thumbnailUrl}}"/> +          <a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a> +          {{reply.content | html}} +        </li> +      </ul> +    </li> +  </ul> +  </body> +</html> diff --git a/example/buzz/buzz.js b/example/buzz/buzz.js new file mode 100644 index 00000000..871982d7 --- /dev/null +++ b/example/buzz/buzz.js @@ -0,0 +1,19 @@ +angular.service('myApplication', function($resource){ +  this.Activity = $resource( +      'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments', +      {alt:'json', callback:'JSON_CALLBACK'}, +      { +        get:     {method:'JSON', params:{visibility:'@self'}}, +        replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}} +      }); +}, {inject:['$resource']}); + +function BuzzController(){ +  this.$watch('$location.hashPath', this.userChange); +} +BuzzController.prototype = { +  userChange: function(){ +    this.userId = this.$location.hashPath; +    this.activities = this.Activity.get({userId:this.userId}); +  } +}; | 
