ngdialog

0.0.3 • Public • Published

ngdialog

angular dialog only takes care of show & hide

Usage

angular.module('app', ['ng-ui'])
  .controller('rootCtrl', ['ngDialog', fucntion(ngDialog) {
    ngDialog.show({
      templateUrl: '/data/html/modal.html',
      controller: function() {
        this.title = 'hello';
        this.content = 'world';
 
        this.onConfirm = function() {
          // do something
        };
 
        this.onCancel = function() {
          // do something else
        };
      },
      controllerAs: 'modal'
    });
  }]);
<section>
  <header ng-bind="modal.title"></header>
  <div ng-bind="modal.content"></div>
  <footer>
    <button ng-click="modal.onConfirm()">Confirm</button>
    <button ng-click="modal.onCancel()">Cancel</button>
  </footer>
</section>

API

name type info
templateUrl STRING 模版路径 (仅支持 absUrl)
controller FUNCTION 模版 controller
controllerAs STRING 模版 alias
parentElement DOM 可选参数,模版容器 (未指定则用 body)
template STRING 模版 html

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ngdialog

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • klam