Skip to content

Instantly share code, notes, and snippets.

View wvuong's full-sized avatar

will vuong wvuong

  • chariot solutions (http://chariotsolutions.com/)
  • philadelphia, pa usa
View GitHub Profile
@wvuong
wvuong / controller.js
Created July 3, 2013 03:19
Example of custom validation for an account registration form via directives. Note: the validateUnique directive's expression expects a promise because the server-side uniqueness check is asynchronous.
angular.module('registerapp.controllers', ['registerapp.services']).
controller('RegisterFormController', ['$scope', '$window', '$location', 'UsernameService', '$q', function($scope, $window, $location, UsernameService, $q) {
$scope.user = {};
$scope.checkUsername = function() {
if ($scope.user.username) {
return UsernameService.checkForDuplicateUsername($scope.user.username);
}
};
@wvuong
wvuong / angular.jsp
Created June 11, 2013 22:30
Context paths and AngularJS
<script>
// inject inlined constants
angular.module('app.constants', [])
.constant('contextPath', '${pageContext.request.contextPath}');
</script>
@wvuong
wvuong / PlacesRESTController.java
Created May 29, 2013 20:38
Simple generic REST-ful Spring MVC controller, interops with Spring Data repositories
package com.willvuong.foodie.controller;
import com.willvuong.foodie.dao.PlaceRepository;
import com.willvuong.foodie.domain.Place;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;