我正在尝试在我的角度应用程序中实现一个模态服务。现在我使用的是角模态服务(http://www.dwmkerr.com/the-only-angularjs-modal-service-youll-ever-need/)。
这个博客说我们可以不用引导就实现这个模式,但是没有例子。有什么帮助吗?
现在我也尝试了引导。但到目前为止还没有运气。这是我的控制器
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。相反,它应该显示为一个模式,在屏幕上。
发布于 2014-09-11 06:46:59
模式的工作方式是在要显示为模态的元素上放置一些类;然后,CSS与这些类一起工作,使元素以您希望的方式显示。听起来,类仍然在元素上,但没有CSS将它放在您想要的地方。我建议从引导源中汲取灵感,找出如何使CSS实现您想要的功能。
https://stackoverflow.com/questions/25780390
复制相似问题