我是angularjs的新手,每当我单击“登录/注册”按钮然后显示弹出窗口时,现在我要是如果我单击“上载简历”(另一个文件),则应该出现相同的弹出窗口
这是我的代码,可以正常工作(文件位置为/ var / www / html / views / common)
<header id="top" ng-controller="headerCtrl" roller class="navbar js-navbar-affix">
<div class="container">
<div class="row">
<div class="col-xs-6">
<ul class="nav navbar-nav navbar-right text-right">
<li><button type="button" class="btn btn-info btn-lg hoj-blue-light login-reg-btn bold"
data-toggle="modal" ng-click="openModal()">
Login / Signup
</button>
</li>
</ul>
</div>
</div>
</div>
</header>
现在,如果我尝试使用以下代码(文件位置为/ var / www / html / views / user / mainScreen),但其不起作用,我在哪里错了?
<header id="top" ng-controller="headerCtrl" roller class="navbar js-navbar-affix">
<button type="button" class="btn btn-info btn-lg hoj-blue-light login-reg-btn bold"
data-toggle="modal" ng-click="openModal()">
Login / Signup
</button>
</header>
答案 0 :(得分:0)
script.js
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('ModalCtrl', function($scope, $uibModal) {
$scope.open = function() {
var modalInstance = $uibModal.open({
templateUrl: "modalContent.html",
controller: "ModalContentCtrl",
size: '',
});
modalInstance.result.then(function(response){
$scope.result = `${response} button hitted`;
});
};
})
app.controller('ModalContentCtrl', function($scope, $uibModalInstance) {
$scope.ok = function(){
$uibModalInstance.close("Ok");
}
$scope.cancel = function(){
$uibModalInstance.dismiss();
}
});
modalContent.html
<div class="modal-header">
<h3>Modal header</h3>
</div>
<div class="modal-body">
<h4>Just something random here</h4>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
index.html
<body ng-app="plunker">
<div ng-controller="ModalCtrl">
<button class="btn btn-info" ng-click="open()" style="margin: 15px;">Open Modal</button>
<h2 style="color: red;">{{result}}</h2>
</div>
</body>
</html>
style.css
.left-nav,.right-nav{
float:left;
}
.right-nav{
margin-left:20px;
}
a{
cursor:pointer;
}
.modal-header {
text-align: center;
}