html - Javascript not getting called inside div of ionic template hml file -


in ionic app controller received json string of comma separated values. want display json string in html in tabular format. html placed inside template directory.

i calling java script function div of html achieve js function not getting hit. js included in index.html. doing wrong?

here sample:

the template/shop.html file:

<ion-tabs class="tabs-icon-top tabs-color-active-positive"> <!-- dashboard tab --> <ion-tab title="status" icon-off="ion-ios-pulse" icon-on="ion-ios-pulse-strong">     <ion-view view-title="shop">         <ion-content>             <ion-list>                 <ion-item ng-repeat="shop in shoplist"> <!--                     <div class="row">                         <div class="col col-50 text-center">                             <script type="text/javascript">                                 **createtable({{shop.method}})**                             </script>                         </div>                     </div> -->                     <div id="method"></div>                             <script>                                 console.log("inside div");  **here call js function**                                  **createtable({{shop.method}});**                             </script>                 </ion-item>             </ion-list>         </ion-content>     </ion-view> </ion-tab> <!-- chats tab --> <ion-tab title="chats" icon-off="ion-ios-chatboxes-outline" icon-on="ion-ios-chatboxes">     <ion-view view-title="shop">         <ion-content>             <ion-list>                 <ion-item ng-repeat="shop in shoplist">                     <div class="row">                         <div class="col col-50 text-center">                             {{shop.offers}}                         </div>                     </div>                 </ion-item>              </ion-list>         </ion-content>     </ion-view> </ion-tab> 

and here smaple js function placed in utility.js

//function createtable($scope, method){ function createtable(method){ //    var tar=document.getelementbyid(method); //    $scope.shopmethod = [];       var table=document.createelement('table');       table.border='1';       var tbdy=document.createelement('tbody');       table.appendchild(tbdy);                 (var j=0;j<4;j++){                        var tr=document.createelement('tr');                        tbdy.appendchild(tr);                        (var k=0;k<2;k++){                         var td=document.createelement('td');                         td.width='100';                         if(k==0) td.innerhtml="school" +(j+1);                         else    td.innerhtml="percent" +(j+1);                                                                     tr.appendchild(td);                        }               }      //tar.appendchild(table);  //                            <div class="row"> //                            <div class="col col-50 text-center"> //                                {{shop.method}} //                            </div> //                        </div> //                            </div> // $scope.shopmethod.push(table);      console.log(table); //document.getelementbyid(method).innerhtml="hello" } 


Comments