Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validations of the input
Message
From
07/09/2017 09:11:18
 
General information
Forum:
AngularJS
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01653867
Message ID:
01654082
Views:
39
>I'm getting strange error (500).
>
>My HTML is this
>
>
> sm-code-unique-validator
>                       table-name="items"
>                       column-to-test="barcode"
>                       primary-key="currentItem.itemId"
>                       ng-model-options="{ debounce: { default : 500, blur: 0 }}"
>
>and the code is
>
>
>ngModel.$asyncValidators.smCodeUnique = function (value) {
>                    if (value) {
>                        var codeObject = {
>                            id: $scope.primaryKey, tableName: $scope.tableName,
>                            columnToTest: $scope.columnToTest, code: value
>                        };
>
>                        $log.debug(codeObject);
>                        return services.Item.checkCodeUniqueness(codeObject);
>                    }
>                    else
>                    {
>                        return true;
>                    }
>                };
>
>I am still getting 500 error and also why the code is always firing? I don't need to fire validators if I didn't touch the control.

If your getting a 500 then obviously something is failing on the server - you need to debug that.
Don't know why your directive is firing when there's no change on the control. Maybe you can add something to the directive to determine where the call needs to be made ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform