title: Angular 4 "Property does not exist on type component"
body: <p>This last week I've started learning Angular 4 and TypeScript, and I've hit my first roadblock. </p>
  
  <p>I'm trying to make a simple date and time component. From a Javascript view I can't see anything wrong, but I think I'm not working with scope the way Angular wants, so I'm looking for some guidance. The error is:
  <code>Failed to compile very/long/file/path/date-time.component.ts (35,18): Property 'date' does not exist on type 'DateTimeComponent'.</code></p>
  
  <p>I suspect I'm not putting my methods in the right place, or I need to declare my properties outside of <code>setTime()</code>. Any advice much appreciated.</p>
  
  <p>date-time.component.ts:</p>
  
  <pre><code>export class DateTimeComponent implements OnInit {
  
    constructor() { 
  
    }
  
    ngOnInit() {
      this.setTime();
    }
  
    checkTime(i) {
      return (i &lt; 10) ? "0" + i : i;
    }
  
    setTime() {
  
      let month = ["January", "February", 
      "March", "April", 
      "May", "June", 
      "July", "August", 
      "September", "October", 
      "November", "December"];
  
      //date
      let date: Date = new Date(); // this only accessible within setTime() method
      let d: any = date.getDate();
      let m: any = date.getMonth();
      let y: any = date.getFullYear();
      //time
      let h: any = date.getHours();
      let min: any = date.getMinutes();
      let s: any = date.getSeconds();
  
      let newMin: any = this.checkTime(this.min);
      let newS: any = this.checkTime(this.s);
  
      let myDate: any = d + " " + month[this.m] + " " + y;
      let myTime: any = h + ":" + newMin + ":" + newS; 
  
      let t: any = setTimeout(() =&gt; {
        startTime()
      }, 500);
  
    }
  
  } //end of class
  </code></pre>
  
  <p>date-time.component.html:</p>
  
  <pre><code>&lt;div ng-controller='TimeCtrl'&gt;
    &lt;p&gt;{{ myDate }}&lt;/p&gt;
    &lt;p&gt;{{ myTime }}&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>