angularjs - Phonegap.js on second html page -


i have 2 pages in phonegap application building pgb (index.html , main.html), both use angular.js. index.html login app, redirects main.html afterwards. plugins , phonegap.js being injected fine main, none of inline js (alerts on doc ready, device ready, window load) firing, let alone phonegap.js being loaded well.

any advice appreciated.

script includes:

<script src="phonegap.js"></script> <script src="cdv-plugin-fb-connect.js"></script> <script src="facebook-js-sdk.js"></script> <script>alert("inside pg");</script> <script src="childbrowser.js"></script> <script src="js/jquery.js"></script> <script src="js/angular.min.js"></script> <script>alert("here");</script> <script src="js/controllers.js"></script> <script src="js/klass.min.js"></script> <script src="js/code.photoswipe.jquery-3.0.5.min.js"></script> <script src="js/maskedinput.js" type="text/javascript"></script> <script src="js/jquery.joyride.js"></script> <script src="js/jquery.fancybox.pack.js"></script> <script src="http://connect.facebook.net/en_us/all.js" type="text/javascript"></script> 

scripts:

 alert("p2 adding")  document.addeventlistener("deviceready", ondeviceready, false);  // phonegap loaded , safe make calls phonegap methods // function ondeviceready() {     alert("main.html: device ready"); }  $(window).load(function(){   alert("window.load happening"); }) </script>  <script>    var _gaq = _gaq || [];   _gaq.push(['_setaccount', 'ua-42023187-1']);    _gaq.push(['_trackpageview']);    (function() {     var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true;     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';     var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s);   })();    (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o),   m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m)   })(window,document,'script','//www.google-analytics.com/analytics.js','ga');    ga('create', 'ua-42023187-1', 'openvino.com');   ga('send', 'pageview');  </script>  <script type="text/javascript">   var objecttolike = window.location;   var fbactivated = false;      fb.init({       appid      : '659381964079214', // app id       channelurl : '', // channel file, not required leave empty       status     : true, // check login status       cookie     : true, // enable cookies allow server access session       oauth      : true,       xfbml      : true  // parse xfbml     });     fb.event.subscribe('auth.authresponsechange', function(response) {       // here specify response anytime event occurs.        if (response.status === 'connected') {         getfriends();         testapi();         fbactivated = true;       }     });    function getfriends() {     var fbuserids = []     fb.api('/me/friends', function(response) {         if(response.data) {           $.each(response.data,function(index,friend) {               var id = friend.id;               fbuserids.push(id);           });           var datastring = "fbuserids="+fbuserids.join();           $.ajax({             type: "post",             data: datastring,             async: false,             url: "http://m.openvino.com/scripts/favematch.php"           }).done(function(data){           console.log(data);           window.localstorage.setitem("fbfriends", data);           console.log("saved");           });         } else {             alert("error!");         }     });   }      function testapi() {     fb.api('/me', function(response) {       //console.log(response, response.email);       var datastring2 = "id=" + response.id;       datastring2 += "&first_name=" + response.first_name;       datastring2 += "&last_name=" + response.last_name;       datastring2 += "&email=" + response.email;        console.log(datastring2);       $.ajax({         type: "post",         url: "http://m.openvino.com/scripts/fbconnect.php",         data: datastring2       }).done(function(data){         var datajson = $.parsejson(data);         if (datajson[0].status == "failure") {           //console.log(datajson[0].message);           return false;         } else if (datajson[0].status == "success") {           window.localstorage.setitem('email',datajson[0].cookie.email);           window.localstorage.setitem('password',datajson[0].cookie.password);           window.localstorage.setitem('name_first',datajson[0].cookie.name_first);           window.localstorage.setitem('name_last',datajson[0].cookie.name_last);           window.localstorage.setitem('uid',datajson[0].cookie.uid);           window.localstorage.setitem('phone',datajson[0].cookie.phone);           window.localstorage.setitem('firsttime',datajson[0].cookie.firsttime);         }       });     });   }    function fblogout() {     if (fbactivated) {        try {         fb.logout(function(response) {           window.location.href = "index.html";         });       } catch (err) {         window.location.href = "index.html";       }     } else {       window.location.href = "index.html";     }   }    $(document).ready(function() {        alert("document.ready loaded");      $("#logmeout").click(function(e){         e.preventdefault();         window.localstorage.clear();          fblogout();         return false;     });      $('.back_btn').click(function(e) {       $('.profile_menu').hide();       history.back();     });      $(document).click(function(e) {       $('.profile_menu').hide();     })      $('.profile_btn').click(function(e) {       $('.profile_menu').slidetoggle();       e.stoppropagation();       e.preventdefault();       return false;     });      $('.profile_menu a').each(function() {       $(this).click(function(e) {         $('.profile_menu').hide();       });     });   }); 

html:

<body ng-app="openvino"> <div id="fb-root"></div> <div class="header-wrap">   <header>     <div ng-show="(page != 'list')" class="back_btn"></div>      <a href="#" onclick="launchbrowser(http://facebook.com)"><img src="imgs/logo_only.png" alt="openvino" /></a>     <div class="profile_btn"></div>   </header> </div> <div class="profile_menu">   <a href="#/users/">my favorites</a>    <a href="#/aboutus/">contact openvino</a>   <a href="#/lifestyle/">images</a>   <a href="#" id="logmeout">logout</a> </div> <div class="content {{page}}" ng-view></div> 

i fixed simple, disheartening solution: have turn multipage app 1 page app. unfortunate how phonegap advertises can take html, css, , js , build natively. of .js loaded on second page wouldnt work until changed login partial , fooled around routing.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -