AngularJS helper functions