Create Angular Constant using Typescript class

AngularJs constant does not accept any injection and they are normally static content.

module app.Constant {
 export interface IMyConstant {
 exposedValue: string[];

 class MyConstant implements IMyConstant {
   static get getConstant() {
      return new MyConstant();
   exposedValue: string[];
   constructor() {
       this.exposedValue = ['somevalue', 'somevalue1'];
  angular.module('app').constant('MyConstant', MyConstant.getConstant);

This post



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s