title: Why is my imported variable undefined?
body: <p>This is my Angular app, and I wanted to move my HTML template to separeted file (template.ts):  </p>
  
  <pre><code>import { Component } from '@angular/core';
  import {Template} from './template'
  
  export class entity {
      id:number;
      name:string;
      dob:string;
  }
  
  let USERS: entity[] = [
      {id: 0, name: 'Jon Smith', dob: '01.10.1990'},
      {id: 1, name: 'asd qwe', dob: '22.04.1988'}
  ];
  
  let myTemplate: Template;
  
  @Component({
    selector: 'my-app',
    template: myTemplate.code,
  })
  
  export class AppComponent {
      name = 'Angular';
      Users = USERS;
  }
  </code></pre>
  
  <p>Template file:</p>
  
  <pre><code>export class Template {
      code:string =`
              &lt;h1&gt;Список&lt;/h1&gt;
              &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
                  &lt;div class="modal-dialog" role="document"&gt;
                      &lt;div class="modal-content"&gt;
                          &lt;div class="modal-header"&gt;
                              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
                                  &lt;h4 class="modal-title" id="myModalLabel"&gt;Modal title&lt;/h4&gt;
                          &lt;/div&gt;
                          &lt;div class="modal-body"&gt;
              ...
                          &lt;/div&gt;
                          &lt;div class="modal-footer"&gt;
                              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                              &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;table class="table table-hover table-bordered"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt; id &lt;/th&gt;
                          &lt;th&gt; &lt;/th&gt;
                          &lt;th&gt; &lt;/th&gt;
                          &lt;th&gt; &lt;/th&gt;
                          &lt;th&gt; &lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;th&gt; {{Users[0].id}} &lt;/th&gt;
                          &lt;th&gt; {{Users[0].name}} &lt;/th&gt;
                          &lt;th&gt; {{Users[0].dob}} &lt;/th&gt;
                          &lt;th&gt; &lt;button class="crud__DeleteEditButton form-control" data-toggle = "modal" data-target = "#myModal"&gt; &lt;/button&gt; &lt;/th&gt;
                          &lt;th&gt; &lt;button class="crud__DeleteEditButton form-control"&gt; &lt;/button&gt; &lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;th&gt; {{Users[1].id}} &lt;/th&gt;
                          &lt;th&gt; {{Users[1].name}} &lt;/th&gt;
                          &lt;th&gt; {{Users[1].dob}} &lt;/th&gt;
                          &lt;th&gt; &lt;button class="crud__DeleteEditButton form-control"&gt; &lt;/button&gt; &lt;/th&gt;
                          &lt;th&gt; &lt;button class="crud__DeleteEditButton form-control"&gt; &lt;/button&gt; &lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
      `
  }
  </code></pre>
  
  <p>But I keep getting 'Cannot read property of undefined' error on <code>template = myTemplate.code</code>
  What is wrong?
  Here is my AppModule file:</p>
  
  <pre><code>import { NgModule }      from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import {FormsModule} from '@angular/forms';
  import { AppComponent }  from './app.component';
  import {Template} from "./template";
  
  @NgModule({
    imports:      [ BrowserModule, FormsModule ],
    declarations: [ AppComponent, Template ],
    bootstrap:    [ AppComponent ],
    providers:    [Template]
  })
  export class AppModule { }
  </code></pre>