Giter Club home page Giter Club logo

tnotify's Introduction

TNotify [DEPRECATED!] Please use angular-ios-alertview

ios7+ style alert confirm and prompt service for angular

Usage

  1. include tnotify[.min].js and tnotify[.min].css in your html.
  2. include TNotify as a angular dependence
  3. inject TNotify in your controllers, services or something else.
  4. use TNotify.alert, TNotify.confirm or TNotify.prompt.

Options

  • title => default empty, this is shown in modal title
  • text => required when you invoke alert or confirm or prompt, tell user what do you want. Its best to set the text option when you invoke specific method.
  • cancelText => cancel button text, default 取消
  • okText => ok button text, default 确定
  • inputType => the prompt input type, default text
  • inputPlaceHolder => the prompt input placeholder, default empty

You can use TNotifyProvider to set default option via

module.config(['TNotifyProvider', function(TNotifyProvider){
  TNotifyProvider.set('title', 'default Title');
  TNotifyProvider.set({
    cancelText: 'cancel',
    okText: 'good'
  });
}]);

API

  1. alert
    • params: String or Object. when string, the option.text is set.
    • return: promise.
    • example
    TNotify.alert('alert').then(function(){
      // Your code here.
    });
  2. confirm
    • params: String or Object. when string, the option.text is set.
    • return: promise. then callback function will get the user's confirm: true or false
    • example
    TNotify.confirm('Do you want to cancel?').then(function(result){
      if(result === true){
        // yes
      }else if(result === false){
        // no
      }
    });
  3. prompt
    • params: String or Object. when string, the option.text is set.
    • return: promise. the callback function will get the user's input(empty string or what the user input) when use click ok button, or get null when user click cancel button.
    • example
    TNotify.prompt('input your telphone').then(function(result){
      console.log(result);
      // the result will be `null` when user click cancel button
      // the result will be what the user input or empty string
      // when user click ok button
    });

Thanks

License

MIT

tnotify's People

Contributors

wyntau avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

0224098 coatifly

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.