尝试提交表单时出现模态错误

时间:2019-06-05 00:58:28

标签: javascript html css angularjs

基本上,我正在打开一个模式来创建一个用户,在该用户中输入用户名。由于某些原因,提交按钮不起作用,有人可以帮我吗?

HTML按钮调用模式。

<button class="btn btn-primary pull-right" style="float: right;" ng-click='createUser()' id="users-create-user">
    <span translate="createUser"></span>
</button>

我的表格

<form role="form" id="CreateUserForm" ng-submit="ok(user)">
    <div class="modal-header bg-primary">
        <h3 class="modal-title">
            <span translate="userdetails"></span>
        </h3>
    </div>
    <div class="modal-body">
        <div class="form-group">
            <label translate="username">
            </label>
            <input id="users--user-name" class="form-control" type="text" ng-model="user.GlobalSightUsername" required maxlength="200">
        </div>        
    </div>
    <div class="modal-footer">
        <button id="dialog--ok_confirm" type="submit" class="btn btn-primary" translate="ok">
        </button>
        <button id="dialog--cancel" type="button" class="btn btn-default" ng-click="cancel()" translate="cancel">
        </button>
    </div>
</form>

JavaScript

$scope.createUser = function(user) {
  return $uibModal.open({
    templateUrl: 'views/users/createUser.html',
    controller: 'Users',
    resolve: {
      user: function() {
        return angular.copy(user);
      }
    }
  }).result.then(function(newUser) {
    $scope.adding = true;
    return $http.put($config.serverAddress + "User/CreateUsers", newUser).then(function(response) {
      $scope.adding = false;
      return DialogService.dialog('success', 'success', 'addedUserSuccess');
    })["catch"](function() {
      $scope.adding = false;
      return DialogService.error("error", "errorAddingUser");
    });
  });
};

我还用一些虚拟数据测试了我的支持,因此错误不是从那里来的,任何帮助将不胜感激!

0 个答案:

没有答案