I am writing an Angular app coming from a PHP background. I wanted to know if there are any good assert/validation libraries I can use to help me validation the arguments passed in to my models e.g. Validate.isNumber(data.id) and automatically throw an appropriate exception on failure
app.factory('Something', ['moment', function(moment){
function Something(data) {
// validate data has required properties and they are of the expected type!!!
this.id = data.id;
this.title = data.title;
this.description = data.description;
}
Something.prototype.getId = function () {
return this.id;
};
Something.prototype.getTitle = function () {
return this.title;
};
Something.prototype.getDescription = function () {
return this.description;
};
return Something;
}]);