Xeditable表单不会提交

时间:2015-03-16 11:34:14

标签: angularjs

我使用Xeditable更新用户的信息。

我的表格如下:

<form editable-form name="updateUser" onaftersave="updateUser()">
   <div class="clearfix m-b">
     <span class="thumb-sm"><img src="{{user.image_path || 'img/AdamProfil.png'}}" alt="{{user.profile.firstname}} {{user.profile.lastname}}" class="img-circle" /></span>
     <div class="m-t-xs m-b-xs">
       <h4 class="h4">{{ selectedUser.profile.firstname }} {{ selectedUser.profile.lastname }}</h4>
       <small class="block">{{ selectedUser.title.name }} - {{ selectedUser.Division.name }}</small>
     </div>
     <article class="media">
       <small class="text-uc text-sm text-muted">Privat</small>
       <div class="form-group m-b-xs">
         <label class="font-bold block m-b-none" for="selected_address">Addresse</label>
         <small class="block" id="selected_address" editable-text="selectedUser.profile.address" e-form="">{{ selectedUser.profile.address || 'Ikke udfyldt' }}</small>
       </div>
       <div class="form-group m-b-xs">
         <label class="font-bold block m-b-none" for="selected_username">Email</label>
         <small class="block" id="selected_username" editable-email="selectedUser.username">{{ selectedUser.username || 'Ikke udfyldt' }}</small>
       </div>
       <div class="form-group m-b-xs">
         <label class="font-bold block m-b-none"  for="selected_phone">Telefon</label>
         <small class="block" id="selected_phone" editable-text="selectedUser.profile.phone">{{ selectedUser.profile.phone || 'Ikke udfyldt' }}</small>
       </div>
       <div class="form-group m-b-xs">
         <label class="font-bold block m-b-none" for="selected_cpr">Fødselsdag</label>
         <small class="block" id="selected_cpr" editable-text="selectedUser.profile.cpr">{{ selectedUser.profile.cpr || 'Ikke udfyldt' }}</small>
       </div>
       <div class="form-group m-b-xs">
         <label class="font-bold block m-b-none" for="selected_description">Bemærkninger</label>
         <small class="block" id="selected_description" editable-text="selectedUser.profile.description">{{ selectedUser.profile.description || 'Ikke udfyldt' }}</small>
       </div>
   </article>
   <hr class="b-b">
   <button type="submit" class="btn btn-default btn-rounded" ng-disabled="updateUser.$waiting" ng-show="updateUser.$visible" tooltip="Gem"><i class="fa fa-floppy-o"></i></button>
   <button type="button" class="btn btn-grey btn-rounded" ng-disabled="updateUser.$waiting" ng-click="updateUser.$cancel()" tooltip="Annuller"><i class="fa fa-ban"></i></button>
   </div>
</form>

我的控制员:

$scope.updateUser = function()
{
    $http({url: api.getUrl('user', user.id),
        method: "PUT",
        data: { user: user }
    }).success(function (data, status, headers, config) {
    }).error(function (data, status, headers, config) {
    });
};

我的问题是,当我尝试提交表单时,它会出现以下错误(因此不会运行控制器):

TypeError: Cannot read property '0' of null
    at $parseFunctionCall (angular.js:12337)
    at FormController.e.ngSubmit.e.submit.e.onaftersave.g.$onaftersave (xeditable.min.js:6)
    at FormController.g.$save (xeditable.min.js:6)
    at val (angular.js:1002)
    at c (xeditable.min.js:6)
    at Object.then (xeditable.min.js:6)
    at FormController.a (xeditable.min.js:6)
    at angular.js:997
    at c (xeditable.min.js:6)
    at Object.then (xeditable.min.js:6)

我现在已经搜索了一段时间,但我找不到任何有用的东西。而且我在Angularjs也很新。

0 个答案:

没有答案