import { Component,Input, AfterContentInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'dropdown',
  styles: [],
  template: `
      <div dropdown class="dropdown d-inline-block">
       <a   dropdown-open style="cursor: pointer"> <span class="fa fa-file" style="cursor: pointer"></span> {{dropdownName}}   <span class="fa fa-chevron-down" style="cursor: pointer"></span></a>
      <div class="dropdown-menu" >
        <a class="dropdown-item"  style="cursor:pointer;" *ngFor="let menu of dropdownListVlue" (click)="navigateUrl(menu.link)" ><span class="{{menu.icon}}"></span> {{menu.name}}</a>
         </div>
    </div>
  `
})
export class DropdownComponent implements AfterContentInit{ 
//private router: Router;
   @Input('dropdown-name') dropdownName: string;
   @Input('dropdown-list-value') dropdownListVlue: Array<any>;
      constructor(private router: Router) {
        
        this.router = router;

      }
    
 ngAfterContentInit() {
     this.dropdownName=this.dropdownName;
this.dropdownListVlue=this.dropdownListVlue;
    }
    navigateUrl(link){
  this.router.navigate([link]);

    }
    
}
