migrated js script to angular controller and created angular.module