如何将HTML包括在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是术语model.html

我的JS,

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

,但我不确定应该在哪里包括此术语模型。谁能帮我吗?

如果您使用bootstrap,则可以使用bootstrap模态对话框。在您的html中添加ng-conclude如下所示。

html

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

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

最新更新