2

我的 angularjs 页面中有一个电子邮件文本框,如下所示:

<div class="form-group form-control-default required">
 <input type="email" class="form-control" ng-model="signUpParams.email" name="email" id="InputEmail1" placeholder="Email" required> </div>

我想显示在我的 ng-dialog 中输入的电子邮件。这是我的 ng-dialog 脚本标签的一部分:

<script type="text/ng-template" id="templateId">
  <div class="media-body act-media-body">
     <h5 class="success" style="color:#84b642">Now it is time to complete this process</h5>
      <p class="margin-v-35-0">Thank you for signing up for your account. to complete this process you have to confirm by clicking the link we have mailed to your mail account : user@example.com</p>
  </div>                   
</script>

我想用输入的电子邮件替换p 标签静态数据中的user@example.com 。我怎样才能做到这一点?有什么帮助吗?谢谢

已编辑

这是我调用 ng-dialog 的控制器代码:

var loginModule = angular.module('loginModule', ['ngDialog']);
loginModule.controller('loginController', function($scope, $http, $window, ngDialog) {
        $scope.signUp = function() {
            $http.post("/users/createUser",$scope.signUpParams)
            .success(function(response) 
                {
                    if(response.status){

                        if(response.isUserExists){
                            alert(response.message);
                        }else if(response.isMailSendSuccessfully){
                            ngDialog.open({ template: 'templateId',
                                            closeByDocument : false,
                                            preCloseCallback: function(value) {
                                                $window.location.href="/"
                                                }
                                           });
                    }

                    }else{
                        //SOMETHING WENT WRONG
                        alert(response.message);
                    }


                }).error(function(data, status, headers, config) {

                        alert(data)
                });
    };
4

1 回答 1

2

更新调用以ngDialog.open包含您的范围:

ngDialog.open({ template: 'templateId',
    closeByDocument : false,
    preCloseCallback: function(value) {
        $window.location.href="/"
    },
    scope: $scope
});

现在您可以在对话框中引用您的模型:

<p class="margin-v-35-0">Thank ... : {{signUpParams.email}}</p>
于 2015-06-05T06:35:44.650 回答