i can use two function on ng-init ? how?
i've tried an setTimeout to run an function to open a modal and after a time period , it call the function that closes the modal , but does not work ...
like this :
ng-init="setTimeout(closeModal, 2000) && openModal();"
both functions are inside the controller:
function ($scope, $stateParams, $ionicModal, $window, $timeout ) {
$ionicModal.fromTemplateUrl('modal.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function() {
alert("funcionou!");
//$scope.modal.show();
$timeout(function(){
$scope.modal.show();
},0)
};
$scope.closeModal = function() {
$scope.modal.hide();
};
// Cleanup the modal when we're done with it!
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
// Execute action on hide modal
$scope.$on('modal.hidden', function() {
// Execute action
});
// Execute action on remove modal
$scope.$on('modal.removed', function() {
// Execute action
});