title: Using scripts in angular 6 - recaptcha
body: <p>I am trying to implement recaptcha in my project, but I'm not sure how to use it.</p>
  
  <p>I'm importing script in this way:</p>
  
  <pre><code>public loadScript() {
  let body = &lt;HTMLDivElement&gt;document.body;
  let script = document.createElement('script');
  script.innerHTML = '';
  script.src = 'https://www.google.com/recaptcha/api.js';
  script.async = true;
  script.defer = true;
  body.appendChild(script);
  }
  </code></pre>
  
  <p>Then I call this function in component constructor, and it works - recaptcha is properly rendered and works, but how to get response for my backend from it? </p>
  
  <p>I tried <code>grecaptcha.getResponse()</code> but I get <code>ReferenceError: "grecaptcha is not defined"</code> - what is interesting not always. So how to make Typescript know what  grecaptcha is?</p>