gpt4 book ai didi

javascript - 如何在angularjs中包含html

转载 作者:行者123 更新时间:2023-12-03 05:27:24 25 4
gpt4 key购买 nike

我有一个登录表单作为模型,其中有条款和条件按钮,我想在单击该条款时显示另一个模型。因此,当我单击条款按钮时,应显示包含条款的 html。

我的html:

 <div class="col_full">
<input type="checkbox" ng-class="{'error': submitted && registerLoginForm.terms.$error.required}" name="terms" value="check" id="agree" ng-model="register.terms" required/> I agree to the XpertDox <a href="#" ng-click="termsandPolicy('terms')">Terms of Use</a> & <a href="#" ng-click="termsandPolicy('privacy')">Privacy Policy.</a>
</div>

我的条款 html 是 terms-model.html

我的js,

$scope.termsandPolicy = function(type){
$timeout(function(){
if(type == 'terms'){
$('#terms-model').modal('show');
}

}, 1000);

}

但我不确定应该在哪里包含这个术语模型。有人可以帮我吗?

最佳答案

如果您正在使用 Bootstrap ,则可以使用 Bootstrap 模式对话框。在您的 html 中添加 ng-include,如下例所示。

HTML

<ng-include="'template/terms-model.html'"></ng-include>

terms-model.html

<div id="termsModal" class="modal" role="dialog"
tabindex="-1" aria-labelledby="modalLabel" aria-hidden="false" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<!-- Modal content -->
<div class="modal-content">
<!-- Place ur content here -->
</div>
</div>
</div>

JS

$scope.termsandPolicy = function(type){
// Show modal by Id
$('#termsModal').modal('show');
}

关于javascript - 如何在angularjs中包含html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41095474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com