How to bridge ionic with ios native code using WebViewJavascriptBridge


Hey guys, I recently developed an app using ionic, and now I want to bridge it with ios native codes using WebViewJavascriptBridge. Actually I failed on the first step, When I include ionic.bundle.min.js in my index.html file and tried to alert in MainCtrl,it does not work on my ios simulator, but when I put it in browser, it does. And for test, I put jquery for test, it works both in ios simulator and web browser.
Anyone can help? please see this.
I ziped my test project and share it on oneDrive, please see this.


It works. you have a couple of problems with your Test project

  1. typo here: <body ng-contrller="MainCtrl">
  2. boostrap angular this way
angular.module('myApp', ['ionic']).controller('MainCtrl', function($scope) {
        $scope.clickFunc = function(){
          alert("you clicked me");
  1. I put the body <script></script> into a separate js file. I don’t know why it fixes things, but it did.