Angular directive for Canon popovers.
- AngularJS v1.2 or higher
- Canon v1.1 or higher
- jQuery v1.9 or higher
This package is not currently published to either NPM or Bower. Once the API stabilizes, the built files will be published. Until then, you can install directly from the GitHub repository.
To install with Bower, add the following line to dependencies in your bower.json:
"rs-popover": "https://github.com/rackerlabs/rs-popover.git"
This directive defines a popover and can be used as either an element or an
attribute. All instances of this attribute must have a unique id
attribute.
<rs-popover id="myPopover">
This is popover content!
</rs-popover>
Accepts any unique string used to identity this popover. This attribute is required and must be unique across all other elements on the page.
Accepts the name of a function to be called when the popover is opened. This function should return a promise. A loading pattern will be displayed until the promise returned by this method is resolved. This attribute is optional.
This directive toggles a popover's visibility and can only be used as an attribute.
<button rs-popover-trigger="myPopover">Toggle Me!</button>
Accepts the ID of the popover it should toggle. If this attribute is used inside of a popover, it defaults to toggling the containing popover.
In addition to the rs-popover-trigger
directive for toggling popover
visibility, this package also provides a service that can be used to control
popovers programmatically.
angular.module('my.module').controller('MyController', function (registry) {
$scope.toggle = function (e) {
registry.popover('somepopoverid').toggle(e.target);
};
$scope.show = function (e) {
registry.popover('somepopoverid').show(e.target);
};
$scope.hide = function () {
registry.popover('somepopoverid').hide();
};
});
rs-popover is released under the MIT License.