Skip to content

Instantly share code, notes, and snippets.

View mferak's full-sized avatar

Michal Ferak mferak

View GitHub Profile
@stefanvangastel
stefanvangastel / appDirectives.js
Created March 17, 2015 09:50
CakePHP 3 form validation message by AngularJS directive
var appDirectives = angular.module('appDirectives', []);
/**
* Add potential validation fields to form-control form elements (CakePHP 3 with Bootstrap)
*
* Requirement: $scope.errors contains option (validation) errors in default CakePHP 3 JSON response
*/
appDirectives.directive('formControl', function($compile) {
return {
restrict: 'C', //Match all elements with form-control class