Footer TS
This commit is contained in:
37
app/assets/javascripts/controllers/root.ts
Normal file
37
app/assets/javascripts/controllers/root.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ApplicationManager } from './../applicationManager';
|
||||
import { WebDirective } from './../types';
|
||||
import template from '%/root.pug';
|
||||
import { WebApplication } from '@/application';
|
||||
|
||||
class RootCtrl {
|
||||
|
||||
private $timeout: ng.ITimeoutService
|
||||
private applicationManager: ApplicationManager
|
||||
public applications: WebApplication[] = []
|
||||
|
||||
/* @ngInject */
|
||||
constructor($timeout: ng.ITimeoutService, applicationManager: ApplicationManager) {
|
||||
this.$timeout = $timeout;
|
||||
this.applicationManager = applicationManager;
|
||||
this.applicationManager.addApplicationChangeObserver(() => {
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.$timeout(() => {
|
||||
this.applications = this.applicationManager.getApplications();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class Root extends WebDirective {
|
||||
constructor() {
|
||||
super();
|
||||
this.template = template;
|
||||
this.controller = RootCtrl;
|
||||
this.replace = true;
|
||||
this.controllerAs = 'self';
|
||||
this.bindToController = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user