Dynamic Factory using $http