2014-09-11 58 views
0

我正在尝试在我的角应用程序中实现模态服务。现在我正在使用Angular-modal服务(http://www.dwmkerr.com/the-only-angularjs-modal-service-youll-ever-need/)。使用角模式服务而不使用引导程序

博客表示,我们可以在没有bootstrap的情况下实现模式,但没有任何示例。 有什么帮助吗?

现在我试着用bootstrap也。但到目前为止没有运气。 这里是我的控制器

require([ 
    'services/abcService', 
    'angular-services/angular-modal-service', 
    'libraries/bootstrap' 
], function (app) { 
    "use strict"; 

    abcController.$inject = ['angularModalService']; 

    function abcController(abcService, ModalService) { 
     var self = this; 

     abcService.getData().success(function (data) { 
      self.names = data.names; 
     }); 

     self.show = function() { 
      ModalService.showModal({ 
       templateUrl: 'abc.html', 
       controller: 'pqrController' 
      }).then(function (modal) { 
       modal.element.modal(); 
       modal.close.then(function() { 
        console.log("hey !"); 
       }); 
      }); 
     }; 
    }; 

    app.controller('abcController', abcController); 

}); 

这里是pqrController

require([ 
    'angular-services/angular-modal-service' 
], function (app) { 
    "use strict"; 

    function pqrController(close) { 
     this.close = function (result) { 
      close(result, 500); 
     }; 
    }; 

    app.controller('pqrController', pqrController); 

}); 

现在,当我从控制器1调用Show()函数,我得到的模态的HTML上的底部屏幕。相反,它应该在屏幕上显示为模式。

+0

该博客显示了一些关于自定义模式的代码示例[here](http://dwmkerr.github.io/angular-modal-service/)(滚动到最后一个示例)。 – 2014-09-11 06:50:08

回答

1

模态的工作方式是将一些类放在要显示为模态的元素上;然后,CSS将与这些类一起工作,使元素以您希望的方式显示。听起来你仍然有类进入元素,但没有CSS把它放在你想要的地方。我建议从bootstrap源码获取灵感来研究如何使CSS做到你想做的。

+0

谢谢!情况正是如此。我没有使用任何CSS。 – 2014-09-11 07:28:37

相关问题