Reputation: 483
I am trying to make a login modal open on application start. This works properly in Chrome simulation, but not on my LG G3 with Android 5 (if that matters).
The code (for now) is based heavily on the sidemenu starter, which works.
Here is the relevant snippet:
$ionicModal.fromTemplateUrl('/app/login/login.html', {
scope: $scope,
animation: 'slide-in-up',
backdropClickToClose: false,
hardwareBackButtonClose: false,
focusFirstInput: true
}).then(function (modal) {
$scope.modal = modal;
$scope.login();
});
$scope.login = function () {
$scope.modal.show();
};
The then
part is not executed, leaving $scope.modal
as undefined (checked with setting some $scope
variable in it and printing it in the view and also trying to print $scope.modal
in the view - neither are changed).
Additionally, calling the login
function with ng-click
doesn't work as well, obviously.
Any ideas about the disparity? Is it some setting? Or something in the code? Or something else?
Edit: Additional tidbit, if it matters: the code is in a self-executing anonymous function:
(function () {
angular.module('module')
.controller('controller', [
'$scope', '$ionicModal', '$timeout',
function ($scope, $ionicModal, $timeout) {
...
}]);
})();
Upvotes: 0
Views: 194
Reputation: 605
In the case of ionic, a leading slash can be an issue when loading on the device, but still work in the browser. Can you try: app/login/login.html
(without the leading /
).
Upvotes: 1