title: display array of dates in the Angular DropDown Menu
body: <p>In Angular I retrieve timestamp from a JsonFile then I want to display it in the dropdown menu, but I don't know how to get the variable from the ngOnInit() to pass it to the variables, which I use to feed the dropdown menu. I put the placeholder in the code below 'timestamp from ngOnInit()', this must be a string.</p>
  <p>here is the <code>search.component.ts</code> file:</p>
  <pre><code> times: Timestamp[] = [
      { value: 'timestamp from ngOnInit()', viewValue: 'timestamp from ngOnInit()' },
  
    ];
  
    this.Service.getContent().then(results =&gt; {
  
        this.data = results;
  
    for (let i = 0; i &lt; this.data.length; i++) {
  
      Object.entries(this.data[i].x_data).map(([key, value]) =&gt; {
        //timestamp
        this.xvalue = this.data[i].timestamp
     
        //converted timestamp to date &amp; time
        this.date = moment(this.data[i].timestamp).format('DD-MM-YYYY HH:mm:ss').toLocaleString();
  
  
        this.strTimestamp = String(this.xvalue)
        this.strDate = String(this.date)
  
        return {
          timestamp: this.strTimestamp,
          date: this.strDate,
  
  
        }
  
      });
  
        }
  
      })
  
    }
  </code></pre>
  <p>the html file:</p>
  <pre><code>&lt;form&gt;   
      &lt;mat-form-field appearance=&quot;fill&quot;&gt;
        &lt;mat-label&gt;Select timestamp &lt;mat-icon&gt;access_time&lt;/mat-icon&gt;&lt;/mat-label&gt;
        &lt;mat-select [(ngModel)]=&quot;selectedValue&quot; name=&quot;food&quot;&gt;
          &lt;mat-option *ngFor=&quot;let time of times&quot; [value]=&quot;time.value&quot;&gt;
            {{time.viewValue}}
          &lt;/mat-option&gt;
        &lt;/mat-select&gt;
      &lt;/mat-form-field&gt;
      &lt;p&gt; Selected timestamp: {{selectedValue}} &lt;/p&gt;
    &lt;/form&gt;
    
  </code></pre>