簡體   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