title: AngularJS send message to iOS WKWebView
body: <p>I'm running a local webserver in my iOS App that serves an AngularJS app but I don't know how to communicate between the WKWebView and my controller.</p>
  
  <p>In iOS, <code>viewDidLoad</code></p>
  
  <pre><code>WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
  [wkWebConfig.userContentController addScriptMessageHandler:self name:@"interOp"];
  
  
  self.webview = [[WKWebView alloc] initWithFrame:self.view.frame ];
  [self.webview setBackgroundColor:self.view.backgroundColor];
  
  [self.webview loadRequest:request];
  </code></pre>
  
  <p>And from angularJS controller, I need to get the <code>wkwebview</code> object but is undefined:</p>
  
  <pre><code>$scope.showSettings = function(){
       //this is undefined
      window.webkit.messageHandlers.interOp.postMessage(message)
  }
  </code></pre>
  
  <p>If I try it within the <code>head</code> tag of my web page, it works perfectly fine.</p>
  
  <pre><code>&lt;script&gt;
      window.webkit.messageHandlers.interOp.postMessage(message)
  &lt;/script&gt;
  </code></pre>
  
  <p>What am I doing wrong ?</p>