aboutsummaryrefslogtreecommitdiffstats
path: root/example/buzz/buzz.js
diff options
context:
space:
mode:
Diffstat (limited to 'example/buzz/buzz.js')
-rw-r--r--example/buzz/buzz.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/example/buzz/buzz.js b/example/buzz/buzz.js
index 871982d7..40813d16 100644
--- a/example/buzz/buzz.js
+++ b/example/buzz/buzz.js
@@ -15,5 +15,32 @@ BuzzController.prototype = {
userChange: function(){
this.userId = this.$location.hashPath;
this.activities = this.Activity.get({userId:this.userId});
+ },
+
+ expandReplies: function(activity) {
+ var self = this;
+ if (activity.replies) {
+ activity.replies.show = !activity.replies.show;
+ } else {
+ activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}, function(){
+ activity.replies.show = true;
+ });
+ }
}
};
+
+angular.widget('my:expand', function(element){
+ element.css('display', 'block');
+ this.descend(true);
+ return function(element) {
+ element.hide();
+ var watch = element.attr('expand');
+ this.$watch(watch, function(value){
+ if (value) {
+ element.delay(0).slideDown('slow');
+ } else {
+ element.slideUp('slow');
+ }
+ });
+ };
+});