简体   繁体   中英

How to include html in angularjs

I have a login form as a model and in which I have terms and conditions button and I want to show another model when I click on that terms.Therefore when I click on my terms buttons a html containing terms should be shown.

My 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>

my terms html is terms-model.html

my js,

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

            }, 1000); 

        }

But I am not sure that where I should include this terms-model. Can anyone help me please ?

You can use bootstrap modal dialog if u're using bootstrap. Add ng-include in your html like below examples.

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');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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