0.0.3 • Published 8 years ago

ngdialog v0.0.3

Weekly downloads
20
License
MIT
Repository
github
Last release
8 years ago

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

nametypeinfo
templateUrlSTRING模版路径 (仅支持 absUrl)
controllerFUNCTION模版 controller
controllerAsSTRING模版 alias
parentElementDOM可选参数,模版容器 (未指定则用 body)
templateSTRING模版 html

LICENSE

MIT