试图建立一个(我认为)相对简单的模式来显示网站的cookie策略。
政策是关于/cookiepolicy的。检查过了,链接运行得很好。
然后我创建了一个按钮(调用代码)
<a class="btn btn-default" href ng-click="showCookie()">Read More</a>因为我只想调用url的模式,所以不会向html添加更多内容。
调用模式的函数(它也被调用,并按照最后一行报告成功)。
app.controller('IndexController', function($scope, ModalService) {
$scope.showCookie = function (data) {
ModalService.showModal({
templateUrl: "/cookie-policy",
controller: "ModalController"
}).then(function (modal) {
//it's a bootstrap element, use 'modal' to show it
modal.element.modal;
modal.close.then(function (result) {
console.log(result);
});
});
}
});模态也有自己的控制器。
betchaHttp.controller('ModalController', function($scope, close) {
// when you need to close the modal, call close
close("Success!");
});问题是,当我按下它时,页面上没有任何内容,也没有错误信息。我是不是错过了一些很明显的东西(或者不是很明显)?
发布于 2015-09-23 15:10:50
幸运的是,这只是您端的一个小语法错误。观察你的.then()阻塞并改变..。
modal.element.modal; // -- nothing至
modal.element.modal(); // -- fn callJSFiddle链路 -演示
https://stackoverflow.com/questions/32742363
复制相似问题