angular - using directive for correct loading stuff and validate per_page input