Define global constants

In Angular 1.x you can define constants like this:

angular.module('mainApp.config', [])
    .constant('API_ENDPOINT', 'http://127.0.0.1:6666/api/')

What would be the equivalent in Angular (with TypeScript)?

I just don’t want to repeat the API base url over and over again in all my services.

17 Answers
17

Leave a Comment