I have designed a bower component ionic-toast
, which can be used in any ionic framework application. Inspired from few other plugins like toast and ng-notify, which already exists for Angular JS.
No additional plugins required to use this plugin.
Please checkout the below Github repository for the bower component.
You can have a look at ionic-datepicker and ionic-timepicker bower components, which i have created earlier.
##Introduction:
This is an ionic-toast
bower component which can be used with any Ionic framework’s application.
##Prerequisites.
- node.js, bower and gulp.
##How to use:
-
In your project repository install the ionic-toast using bower
bower install ionic-toast --save
This will install the latest version released.
- Then you can see the following directory structure see in your project folder
Give the path of style.css, and ionic-toast.js
in your index.html
file.
`
- In your controller you have to define a function like below to show the toast
`
$scope.showToast = function(){
ionicToast.show(‘This is a toast at the top.’, ‘top’, true, 2500);
};
`
The arguments are as follows. The order of arguments should not be changed.
a) message
is the first argument, which takes any string message.
b) position
is the second argument, which takes on of the three values(top, middle, bottom).
c) stick
is the third argument, which takes either true
or false
.
- If the value is true, the toast will not close automatically. It will be closed once you click on the close button.
- If the value is true, the toast will close automatically, after the given time.
d) time
is the fourth argument, which takes time in milliseconds. If the value is greater than 5000, then it will be considered as 5000(5 seconds) only.
- In your controller you have to define a function like below to hide the toast
$scope.hideToast = function(){ ionicToast.hide(); };
##Screen Shots:
Once you are successfully done with the above steps, you should be able to see the below screen shots.
I have used three buttons here.
The first screen shot shows only the buttons before clicking on them.
Once you click on the button you should see the remaining screen shots.
##Versions:
1) v0.1.0
The whole ionic-toast
component functionality has been implemented, and it can be installed with the command bower install ionic-toast --save
1) v0.1.1
Bug Fix
##License:
MIT
##Contact:
gmail : rajeshwar.patlolla@gmail.com
github : https://github.com/rajeshwarpatlolla
twitter : https://twitter.com/rajeshwar_9032
facebook : https://www.facebook.com/rajeshwarpatlolla
paypal : rajeshwar.patlolla@gmail.com