AnsweredAssumed Answered

access DOM element inside template

Question asked by nupurkul on Jun 18, 2018
Latest reply on Jun 27, 2018 by nupurkul

Hi, I am new to Alfresco. I am developing a process in APS(Alfresco Process Services) for which I designed a form and submit button of this form triggers this process. Now, I used 'adf-start-form' component to display this form on browser using ADF. This template is referenced using #startForm template reference variable. (<adf-start-form  #startForm>). Now I want to access a DOM element (button) inside this form. I have tried following approaches: 

@ViewChild('startForm',{read: ElementRef})
btn: ElementRef;


ngAfterViewInit() {
console.log(this.btn.nativeElement.querySelector(".class of button").innerText);
}

and

@ViewChild('startForm')
startForm: StartFormComponent;

ngAfterViewInit() {
console.log(this.startForm.outcomesContainer.nativeElement.innerText);
}

But, none of them is working. Could you please suggest how to access a DOM element of the form. Thanks.

Outcomes