Communcation between Ionic javascript and Android Java

Hi Guys I am new to Ionic as well as Angular Js.
I am learning both by doing simple project and now I am struggling in communication between java and JavaScript.

I just want to pass values from my java to JavaScript to update my HTML view. I already done, passing values from Java to JavaScript by below code. Thanks Google.


myWebView.addJavascriptInterface(jsInterface, "JSInterface"); 

By this code I can only call JavaScript function not a controller scope function. So I decided to call normal Js function from Java then Normal function to Controller function. Finally I found the below code to call a controller scope function from normal JavaScript function.


 var scope = angular.element(document.getElementById("messageList")).scope();
        scope.number = '345';
        scope.message = 'Shan';


function MessageCtrl($scope) 
   $scope.items = [];
   $scope.number = '';
   $scope.message = '';
   $scope.addItem = function () {
        alert("Message called..");
            number: $scope.number,
            message: $scope.message

but it showing below error.

Uncaught TypeError: Cannot read property '$apply' of undefined 

I tried both $apply and safeApply, not working. Any suggestion will be helpful to me.

Maybe your dom selector is wrong? if angular.element does not find the element scope() will be return undefined and undefined has no method $apply.

Have your resolve this issues, because i have similar issues and i need your help on how to solve this issues.