npm.io
0.0.3 • Published 10 years ago

ngdialog

Licence
MIT
Version
0.0.3
Deps
0
Vulns
0
Weekly
0

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