IdanCo / ng1bs4

AngularJS with Bootstrap 4
https://idanco.github.io/ng1bs4
38 stars 13 forks source link

Pagination validation fix #43

Closed langdonx closed 7 years ago

langdonx commented 7 years ago

I moved validation to $onChanges because it makes more sense there. Also got rid of ng-init as convenient as it was, it was throwing validation errors because it was created the properties after they were needed in the example.

If we're to put this validation everywhere, we should make some utilities classes to make it dead easy. Something like...

ValidationService.validateRequiredNumber(this, 'ngbsPagination', 'currentPage');
ValidationService.validateOptionalNumber(this, 'ngbsPagination', 'currentPage');
ValidationService.validateOptionalStringFromArray(this, 'ngbsPagination', 'size', ['', 'lg', 'sm']);

Or maybe similar... maybe less verbose.

IdanCo commented 7 years ago

Love it!

I'll take a deeper look at validations tomorrow, some tool could be very helpful.