environment-home.component.ts
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {Component, Inject, provide} from 'ng-forward';
import {EnvironmentService} from "../../lib/ng-noosfero-api/http/environment.service";
import {NotificationService} from "../shared/services/notification.service";
/**
* @ngdoc controller
* @name environment.Environment
* @description
* This is the environment controller.
*/
@Component({
selector: 'environment-home',
templateUrl: "app/environment/environment-home.html",
providers: [
provide('environmentService', { useClass: EnvironmentService }),
provide('notificationService', { useClass: NotificationService })
]
})
@Inject(EnvironmentService, "$log", "$sce")
export class EnvironmentHomeComponent {
environment: noosfero.Environment;
constructor(private environmentService: EnvironmentService, private $sce: ng.ISCEService) {
environmentService.get().then((result: noosfero.Environment) => {
this.environment = result;
});
}
getEnvironmentDescription() {
if (this.environment && this.environment.settings && this.environment.settings.description) {
return this.$sce.trustAsHtml(this.environment.settings.description);
}
else {
return "";
}
}
}