Look guys, I made some modifications and notify works on Ionic and fires with a certain time.
I step here to share with you.
index file.html
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Angular Notify Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="angular-notify.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body ng-controller="DemoCtrl">
<div>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>angular-notify</h2>
<p class="lead">Notify - angular - ionic.</p>
</div>
</div>
<ion-content>
<br>
Hora: {{currentTime}}
<br>
</ion-content>
</div>
<script src="angular.js"></script>
<script src="angular-notify.js"></script>
<script src="demo.js"></script>
</body>
</html>
demo js.
angular.module('app', ['cgNotify']);
angular.module('app').controller('DemoCtrl',function($interval,$scope,notify,dateFilter) {
$scope.currentTime = dateFilter(new Date(), 'hh:mm');
$scope.updateTime = $interval(function() {
$scope.currentTime = dateFilter(new Date(), 'hh:mm');
$scope.horaAtual = dateFilter(new Date(), 'hh');
$scope.minutosAtual = dateFilter(new Date(), 'mm');
$scope.SegundosAtual = dateFilter(new Date(), 'ss');
if($scope.minutosAtual == 46 && $scope.SegundosAtual == 0) {
function demoMessageTemplate() {
var messageTemplate = '<span>Agora tudo deu certo!</span> ';
notify({
messageTemplate: messageTemplate,
classes: $scope.classes,
scope:$scope,
templateUrl: $scope.template,
position: $scope.position,
});
}; // fim demoMessageTemplate
window.load = demoMessageTemplate();
} // fim if
}, 1000); // fim do relogio
});
Here’s the whole project
https://github.com/fredtavares2018/notify---angular---ionic
You want the notification to appear before you submit the form?
– Sam
after sending the form.
– Joao Torres
I know. But after you send the form the page is reloaded or is using Ajax?
– Sam
Thank you for helping. the page is reloaded.
– Joao Torres
So. When you submit a form, the page is immediately reloaded, there is no time to see anything... what you should do is show the message AFTER the page is reloaded informing the user that everything worked out, IE, the form was duly received.
– Sam
perfect. have any idea to get this?
– Joao Torres
Yes. After sending the page will be reloaded. Inside the block in the PHP code where everything "worked out", you can call the function that shows the notification.
– Sam
Do not need this onsubmit... you will call the function only if everything went right after sending and reloading the page.
– Sam