Q:

Binding Input id with label in angular 4

I am using a customised version of DateTimePicker in Angular4 application. It is working fine the only concern which I would like to solve is the calendar icon is not clickable. My current functionality is when I change the focus inside the input field of DateTimePicker, drop down calendar appears and it works fine. 
Now I would like to make a simple UX change so when someone clicks on calendar icon it also show the drop down calendar. I have seen so many articles and I know it is do-able by using input Id and bind it in label for attribute. For reference you can see the code snippet.
<input class="form-control"
     data-toggle="dropdown"
     aria-haspopup="true"
     aria-expanded="false"
     aria-label="Date picker"
     type="text"
     id="parentId"
     [name]="parentId"
     #dateInput
     [disabled]="isDisabled"
     (focus)="focusInput()"
     (input)="input$.next($event.target.value)">
  <label class="input-group-append btn" for="parentId">
    <span class="fa fa-calendar"></span>
 </label>

It is working fine and give me expected result see this image.
Now the problem is I used the hardcoded value of field ID inside the input. If I need to used two DateTimePicker then the second calendar icon click will also map to first one. I am looking for solution where I can assign the ID value dynamically and in the same way I could use it inside the label for attribute. I have tried the solution using [id] and [for] by getting values dynamically but it did not solve the issue. You can see the code snippet. Even tough when I check the value assign to ID using inspecter window on browser dynamic values have been assigned to both input Id and label for but in this case click on calendar icon does not work at all.
<input class="form-control"
         data-toggle="dropdown"
         aria-haspopup="true"
         aria-expanded="false"
         aria-label="Date picker"
         type="text"
         [id]="parentId"
         [name]="parentId"
         #dateInput
         [disabled]="isDisabled"
         (focus)="focusInput()"
         (input)="input$.next($event.target.value)">
  <label class="input-group-append btn" [for]="parentId">
    <span class="fa fa-calendar"></span>
  </label>

You can see the attached image for inspect window also.
Any help and suggestion in this regard will be highly appreciated. 
Note: I am working on Angular 4 project.

A:

After spending time using hit-and-try approach, at last able to figure out the issue. The issue was with Id values. I was trying to get value of input id attribute using component. The problem was id was exactly similar as parent Id. So I retrieved the id value from parent component and modified the value. It started working fine. 
Working Solution:
parentId = this.hostElem.nativeElement.id + '_id';

    <input class="form-control"
         data-toggle="dropdown"
         aria-haspopup="true"
         aria-expanded="false"
         aria-label="Date picker"
         type="text"
         [id]="parentId"
         #dateInput
         [disabled]="isDisabled"
         (focus)="focusInput()"
         (input)="input$.next($event.target.value)">
  <label class="input-group-append btn" [for]="parentId">
    <span class="fa fa-calendar"></span>
  </label>

before that I was using 
parentId = this.hostElem.nativeElement.id;

