繁体   English   中英

如何在angularjs中包含html

[英]How to include html in angularjs

我有一个登录表格作为模型,其中有条款和条件按钮,当我单击该条款时我想显示另一个模型,因此当我单击条款按钮时,应显示包含条款的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); 

        }

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

如果您正在使用引导程序,则可以使用引导程序模态对话框。 像以下示例一样,在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>

s

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM