Closed sisodiakaran closed 8 years ago
Hi, any clue?
Hello @sisodiakaran
I tried a sample MobileAngularUI app and I was able to launch Support thus.
In main_controller.js
angular.module('HotlineSample.controllers.Main', [])
.controller('MainController', ['$scope', '$window', function($scope, $window) {
document.addEventListener("deviceready", function(){
if( typeof window.cordova === 'object' ) { // only run when running in device
$window.Hotline.init({
appId : "<your app id>",
appKey : "<your app key>"
});
}
});
$scope.launchSupport = function(){
if( typeof window.cordova === 'object' ) {
$window.Hotline.showFAQs();
}
}
}]);
In index.html
<a href="#" class="btn btn-navbar" ng-click="launchSupport()">Support</a>
Note : The deviceready callback only work when using document . $document doesn't work correctly.
:( My AngulerJS app starts within device ready function see below.
document.addEventListener('deviceready', function () {
// Initialise angular app when device is ready completely
console.log("Device is ready! Initialising angular...");
angular.bootstrap(document.body, ['MyAppName']);
});
Is there any possibility of misconfiguration? As this is old project so it involved lots of plugins listed below:
br.com.dtmtec.plugins.carrier 1.0.0 "Carrier"
co.realtime.plugins.CordovaPush 0.1.4 "CordovaPush"
cordova-plugin-android-support-v7-appcompat 1.0.0 "Android Support v7 AppCompat"
cordova-plugin-datepicker 0.8.6 "DatePicker"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-globalization 1.0.1 "Globalization"
cordova-plugin-whitelist 1.2.2 "Whitelist"
I hunted the issue, my concern about plugin conflict was right plugin "CordovaPush" was actually conflicting. As Hotline and CordovaPush both require some same dependencies and this was the issue. To resolve this issue I removed common dependencies and commented out them.
TADAAAA! Issue resolved. Now its working like a charm.
Hi,
I am using Mobile Angular UI in my application. I have installed plugin and build app successfully. But when I try to access
$window.Hotline
it throwsUndefined
error. I am pretty sure that I am calling the function afterdeviceready
.