0
votes

I'm aware there are similar questions but I havent found anything that answers my question so far Im just trying to create a simple function in my angular application

app.component.ts

formClick() {

    const formContainer = <HTMLElement>document.querySelector('.form-container');
    const spinner = <HTMLElement>document.querySelector('.loading-spinner');
    const form = <HTMLElement>document.querySelector('.email-form');

    form.style.display = 'none';
    spinner.style.display = 'block';

    setTimeout(function(){
       spinner.style.display = 'none';
       formContainer.innerHTML('<h1>Thanks! We will get back to you shortly</h1>')
    }, 1000);
} 

but im getting an error on my formContainer.innerHTML that says

[ts] Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. (property) Element.innerHtml: string

I'm not sure what this means, any help would be appreciated,

Thanks

1
innerHTML is not a function. You assign to it. - unional
@unional yes thank you I'm an idiot haha - Smokey Dawson

1 Answers

2
votes

I think the problem is this line formContainer.innerHTML('<h1>Thanks! We will get back to you shortly</h1>').

It should be formContainer.innerHTML = '<h1>Thanks! We will get back to you shortly</h1>'