Code Monkey home page Code Monkey logo

fo-popover's Introduction

fo-popover

A nice popover

Demo

Install

$ bower install fo-popover --save

Require

Beside

$ bower install beside --save

Usage

<link rel="stylesheet" href="bower_components/fo-popover/dist/css/fo-popover.css" />

<script src="bower_components/beside/dist/beside.js"></script>
<script src="bower_components/fo-popover/dist/js/fo-popover.js"></script>

As a directive

angular.module('app', ['foPopover']);
<button
  class="btn btn-success"
  fo-popover
  popover-position="top center"
  popover-template="popover.html"
>删除</button>

<script id="popover.html" type="text/ng-template">
  <div class="popover-header">
    email
  </div>
  <div class="popover-body">
    <label class="control-label" for="email">email</label>
    <input class="form-control" id="email" ng-model="email" type="email">
  </div>
  <div class="popover-footer">
    <button class="btn btn-primary" ng-click="yes()">确认</button>
    <button class="btn btn-default" ng-click="closePopover()">取消</button>
  </div>
</script>

As a service

<div class="text-center">
  <button id="delete" class="btn btn-default" type="button" ng-click="open()">
    delete
  </button>
</div>

<script id="delete.html" type="text/ng-template">
  <div class="popover-header">
    Delete ?
  </div>
  <div class="popover-body">
    <button class="btn btn-primary" ng-click="yes()">确认</button>
    <button class="btn btn-default" ng-click="closePopover()">取消</button>
  </div>
</script>
angular.module('app', ['foPopover'])
.controller('HomeCtrl', function($scope, foPopover) {
  $scope.open = function() {
    foPopover.open({
      target: document.querySelector('#delete'),
      template: 'delete.hmtl',
      position: 'bottom center',
      scope: $scope
    });
  };

  $scope.yes = function () {
    // todo
    foPopover.close();
  };

});

fo-popover's People

Contributors

matobiely avatar

Watchers

Ravi Duvvuri avatar Adam Martinik 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.