Skip to content

Instantly share code, notes, and snippets.

View wesleycho's full-sized avatar

Wesley Cho wesleycho

View GitHub Profile
@wesleycho
wesleycho / function.js
Last active January 20, 2016 19:39 — forked from icfantv/function.js
Username Validation
vm.username = function($viewValue, $modelValue, scope) {
// check if username matches regex before validating
var value = $modelValue || $viewValue, deferred = $q.defer();
if (UserConfig.ID_REGEX.test(value)) {
scope.options.templateOptions.loading = true;
UserService.username(value).then(function() {
deferred.reject(false);
if($scope.new_user_info.isLocation)
{
if(!$scope.new_user_info.location_id)
{
Location.create($scope.new_user_info.location).success(function(newLocation){
$scope.new_user_info.location_id = newLocation.id;
$scope.new_location = {};
successAddLocation = true;
}).error(function(data, status, header, config) {
if(status == 500)
'use strict';
printio.controller('ProductDetailsCtrl', function($scope, $routeParams, $filter, Printio) {
Printio.getProducts()
.then(fetchProduct)
.then(getShipEstimate)
.then(openProduct)
function fetchProduct(data) {