How to access a constant in an Angular 2 component and service?
<p>I have a constants file <strong>constants.ts</strong>:</p>

<pre><code>export const C0NST = "constant";
</code></pre>

<p>I access it in a service <strong>some.service.ts</strong> like so:</p>

<pre><code>import { C0NST } from './constants';

console.log(C0NST); // "constant"
</code></pre>

<p>However, when I access it in a component template:</p>

<p><strong>some.component.ts</strong>:</p>

<pre><code>import { C0NST } from './constants';
</code></pre>

<p><strong>some.component.html</strong>:</p>

<pre><code>{{ C0NST }} &lt;!-- Outputs nothing --&gt;
</code></pre>

<p>However defining a member in the component class works:</p>

<p><strong>some.component.ts</strong></p>

<pre><code>public const constant = C0NST;
</code></pre>

<p><strong>some.component.html</strong></p>

<pre><code>{{ constant }} &lt;!-- constant --&gt;
</code></pre>

<p>I don't understand why I was able to access the imported constant directly in the service class but not in the component template even though I imported it in the component class.</p>