I am working on a project based on PhoneGap 3.5and Angular.js. I am trying to use the Angular New InAppBrowser window with the following controller:
var gWindow;
window.loadWindow = function(website) {
gWindow = window.open(website, '_blank', 'location=no');
gWindow.addEventListener('loadstart', function(event) {
});
gWindow.addEventListener('loadstop', fLoadStop);
gWindow.addEventListener('loaderror', function(event) {
});
gWindow.addEventListener('exit', fExit);
}
window.fLoadStop = function(event) {
var url = event.url;
var filename = url.substring(url.lastIndexOf('/')+1);
if(filename == "closeinappbrowser.html"){
gWindow.close();
}
}
window.fExit = function(event) {
gWindow.removeEventListener('loadstop', fLoadStop);
gWindow.removeEventListener('exit', fExit);
}
But I do not know why the controller below does not work in the new appbrowser window, but it works in the dekstop browser
newsappblank = angular.module("newsappblank", ["ngRoute", "newsControllersblank", "newsServices", "ngSanitize", "ui.bootstrap", "slugifier", "bn-lazy"]);
newsappblank.config([
"$routeProvider", function($routeProvider) {
return $routeProvider.when("/news/:newsId", {
templateUrl: "partials/news-detail.html",
controller: "NewsDetailCtrl"
}).otherwise({
redirectTo: "../closeinappbrowser.html"
});
}
]);
newsControllersblank = angular.module("newsControllersblank", []);
newsControllersblank.controller("NewsDetailCtrl", [
"$scope", "$rootScope", "$location", "$anchorScroll", "$http", "$routeParams", function($scope, $rootScope, $location, $anchorScroll, $http, $routeParams) {
$rootScope.middlebar = true;
$rootScope.loadbar = false;
alert(1);
return $scope.go = function(path) {
if (path !== '/news/') {
$location.path(path);
$location.hash("top");
return $anchorScroll();
}
};
}
]);