I want to convert an AngularJS Value to TypeScript.
How can i achieve that?
AngularJS
angular.module('your_app').value('cgBusyDefaults',{
message:'Loading Stuff',
backdrop: false,
templateUrl: 'my_custom_template.html',
delay: 300,
minDuration: 700,
wrapperClass: 'my-class my-class2'
});
I tried to create a Class with TypeScript and initialize that class in the definition of the module, but I wasn't successful with that approach.
TypeScript
export class CgBusyDefaults {
private _message: string;
private _backdrop: boolean;
private _templateUrl: string;
private _delay: number;
private _minDuration: number;
private _wrapperClass: string;
constructor() {
this._message = 'Loading Stuff';
this._backdrop = true;
this._templateUrl = 'app/administration/partials/administration-busy.html';
this._delay = 300;
this._minDuration = 700;
this._wrapperClass = 'dv-busy';
}
get wrapperClass(): string {
return this._wrapperClass;
}
set wrapperClass(value: string) {
this._wrapperClass = value;
}
get minDuration(): number {
return this._minDuration;
}
set minDuration(value: number) {
this._minDuration = value;
}
get delay(): number {
return this._delay;
}
set delay(value: number) {
this._delay = value;
}
get templateUrl(): string {
return this._templateUrl;
}
set templateUrl(value: string) {
this._templateUrl = value;
}
get backdrop(): boolean {
return this._backdrop;
}
set backdrop(value: boolean) {
this._backdrop = value;
}
get message(): string {
return this._message;
}
set message(value: string) {
this._message = value;
}
}
angular.module('your_app').value('cgBusyDefaults', new CgBusyDefaults());
Is it possible to define Values with TypeScript? Or maybe I'm just missing something