Coder Social home page Coder Social logo

cristoferdomingues / ionic-toast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rajeshwarpatlolla/ionic-toast

0.0 2.0 0.0 203 KB

'ionic-toast' bower component for ionic framework applications

License: MIT License

JavaScript 82.75% CSS 17.25%

ionic-toast's Introduction

bitHound Score

##Introduction:

This is an ionic-toast bower component which can be used with any Ionic framework's application.

View Demo

##Prerequisites.

  1. node.js, bower and gulp.

##How to use:

1) In your project repository install the ionic-toast using bower

bower install ionic-toast --save

This will install the latest version released.

2) 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.

<!-- path to ionic / angularjs files-->
<script src="lib/ionic-toast/dist/ionic-toast.bundle.min.js"></script>

3) In your application module inject the dependency ionic-toast, in order to work with the ionic toast.

angular.module('mainModuleName', ['ionic', 'ionic-toast']){
 //
}

4) In your controller, inject 'ionicToast'.

.controller('HomeCtrl', ['$scope', 'ionicToast', function($scope, ionicToast) {
  //code here
}])

5) In your template you can use like below

<button class="button button-block" ng-click="showToast()">Show Toast at top with close</button>

6) In your controller you have to define a function like below to show the toast

$scope.showToast = function(){
<!-- ionicToast.show(message, position, stick, time); -->
  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 false, 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.

7) 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.

ionic-toast buttons ionic-toast top ionic-toast middle ionic-toast bottom

##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

1) v0.2.0

Lint issues fixed, npm packages updated, main files added in the package.json, changes in the gulp tasks.

JS and CSS file is combined into one ionic-toast.bundle.min.js file in the dist folder.

##License: MIT

##Contact: gmail : [email protected]

github : https://github.com/rajeshwarpatlolla

twitter : https://twitter.com/rajeshwar_9032

facebook : https://www.facebook.com/rajeshwarpatlolla

paypal : [email protected]

ionic-toast's People

Contributors

rajeshwarpatlolla avatar

Watchers

James Cloos avatar Cristofer Domingues avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.