aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2010-01-18 10:47:08 -0800
committerMisko Hevery2010-01-18 10:47:08 -0800
commit7b558b5382c864b00392f50fa5095e53f7b486d0 (patch)
tree11151fb331cc1c1ef615f6d731e023b500800f27
parent595b4ea097bcb512173b6d4a12924ea1a3d70ecd (diff)
parent86dd83fbd4118acfb01d9a1043f35af170843e8a (diff)
downloadangular.js-7b558b5382c864b00392f50fa5095e53f7b486d0.tar.bz2
Merge branch 'standalone' of github.com:angular/angular.js into standalone
-rw-r--r--example/business_card.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/example/business_card.html b/example/business_card.html
new file mode 100644
index 00000000..cc45529f
--- /dev/null
+++ b/example/business_card.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <script type="text/javascript" src="../lib/underscore/underscore.js"></script>
+ <script type="text/javascript" src="../lib/jquery/jquery-1.3.2.js"></script>
+ <script type="text/javascript" src="../angular.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function(){
+ var scope = angular.compile(document);
+ scope.set('tweetFor', function(username){
+ scope.set('status', 'fetching');
+ scope.set('tweets', []);
+ $.getJSON("http://twitter.com/statuses/user_timeline/"+username+".json", function(tweets){
+ scope.set('tweets', tweets);
+ scope.set('status', "");
+ scope.updateView();
+ });
+ scope.updateView();
+ });
+ scope.set('tweetHome', function(){
+ scope.set('status', 'fetching');
+ scope.set('tweets', []);
+ $.getJSON("http://twitter.com/statuses/home_timeline.json", function(tweets){
+ scope.set('tweets', tweets);
+ scope.set('status', "");
+ scope.updateView();
+ });
+ scope.updateView();
+ });
+ scope.updateView();
+ scope.get('tweetHome')();
+ });
+ </script>
+ <style>
+ .loading {display: none;}
+ .fetching .loading {display: block;}
+ </style>
+ </head>
+ <body ng-class="status">
+ <input type="button" ng-action="tweetHome()" value="User Timeline"/> <br/>
+ Fetch tweets for:
+ <input name="username"/>
+ <input type="button" ng-action="tweetFor(username)" value="Fetch"/>
+ <hr/>
+ <div class="loading">Loading...</div>
+ <ul>
+ <li ng-repeat="tweet in tweets"><img src="{{tweet.user.profile_image_url}}"/>[{{tweet.user.screen_name}}]: {{tweet.text}}</li>
+ </ul>
+ </body>
+</html>