Angular 7 RRS feed

  • Question

  • User527076549 posted


    I am not sure if this is the right place to ask question about angular.Please let me know where i can post angular related question

    i have a modal component inside which i have select picker[bootstrap], which i am accessing via ViewChild,  below is sample

    samplemodal.component.ts file
      selector: 'samplemodal',
      templateUrl: './showlist-modal.component.html',
    export class ShowListModalComponent implements OnInit{
    @ViewChild('selectpickerlist',{static:false}) selectPicker:ElementRef;
        this.selectPicker.nativeElement.selectpicker; [thorwing error-nativeElement of undefined]
    maincomponent.html file
    <samplemodal #samplemodal></samplemodal>
    <button samplemodal.show()></button>

    while loading maincomponent,its throwing error at ngAfterViewChecked() saying nativeElement of undefined.And in modalcomponent.ts cant get selectpicker.Really appreciate your help.Thanks in advance.

    Wednesday, July 17, 2019 5:48 PM

All replies

  • User839733648 posted

    Hi amithashenoy,

    According to your description and code, I'm sorry that I could not reproduce your issue successfully.

    From my point of view, there is nothing strange about your provided code.

    If possible, could you please provide more details that could reproduce your issue?

    This will be easier to help with you.

    You may create a simple demo using stackblitz: https://stackblitz.com/ .

    Best Regards,


    Thursday, July 18, 2019 9:53 AM
  • User-474980206 posted
    Stackoverflow is a better forum for angular..
    Friday, July 19, 2019 3:02 PM