import {Input, Inject, Component} from "ng-forward"; import {ActivityComponent} from "./activity/activity.component"; import {ProfileService} from "../../../../lib/ng-noosfero-api/http/profile.service"; /** * @ngdoc controller * @name NoosferoActivities * @description * The controller responsible to retreive profile activities. */ @Component({ selector: "noosfero-activities", templateUrl: 'app/layout/blocks/activities/activities.html', directives: [ActivityComponent] }) @Inject(ProfileService) export class ActivitiesBlockComponent { @Input() block: noosfero.Block; @Input() owner: noosfero.Profile; activities: any; ngOnInit() { let limit: number = ((this.block && this.block.settings) ? this.block.settings.limit : null) || 5; return this.profileService.getActivities(this.owner.id) .then((response: restangular.IResponse) => { this.activities = response.data.activities; }); } constructor(private profileService: ProfileService) { } }