blob: 6b80a32cae1adb744c67c33a79ebbe17d66e0c3e [file] [log] [blame]
Matteo Scandolo4ba4cf12016-04-20 16:36:17 -07001/**
2 * © OpenCORD
3 *
4 * Visit http://guide.xosproject.org/devguide/addview/ for more information
5 *
6 * Created by teone on 4/15/16.
7 */
8
9(function () {
10 'use strict';
11
12 angular.module('xos.uiComponents')
13
14 /**
15 * @ngdoc directive
16 * @name xos.uiComponents.directive:xosValidation
17 * @restrict E
18 * @description The xos-validation directive
19 * @param {Object} errors The error object
20 * @element ANY
21 * @scope
22 */
23
24 .directive('xosValidation', function(){
25 return {
26 restrict: 'E',
27 scope: {
28 errors: '='
29 },
30 template: `
31 <div>
32 <pre>{{vm.errors.email | json}}</pre>
33 <xos-alert config="vm.config" show="vm.errors.email !== undefined">
34 This is not a valid email
35 </xos-alert>
36 </div>
37 `,
38 transclude: true,
39 bindToController: true,
40 controllerAs: 'vm',
41 controller: function(){
42 this.config = {
43 type: 'danger'
44 }
45 }
46 }
47 })
48})();