I have a global constants like root directory that I want every component to have access to. In another stackoverflow question the answer was to create a constants class and imp
import {Component,bind,provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {FORM_DIRECTIVES} from 'angular2/form';
import {Directive, ElementRef, Renderer, Input,ViewChild,AfterViewInit} from 'angular2/core';
import {Constants} from 'src/constants'
import {ViewChild, Component, Injectable} from 'angular2/core';
@Component({
selector: 'my-app',
template: `{{test}}`,
})
export class App {
test: string;
constructor(cs:Constants){
this.test = cs.root_dir;
}
}
bootstrap(App, [Constants]);
Demo