converted first part of form to bootstrap
[angular-drzb] / app / js / directives.js
1 'use strict';
2
3 /* Directives */
4
5
6 angular.module('myApp.directives', []).
7   directive('appVersion', ['version', function(version) {
8     return function(scope, elm, attrs) {
9       elm.text(version);
10     };
11   }]).
12   directive('myInput', function() {
13     return {
14                 restrict: 'C',
15                 compile: function(element, attrs) {
16                         var my_class = attrs['class'] || '';
17                         var my_type  = attrs['type']  || 'text';
18                         var html = '<div class="controls '+my_class+'">'
19                                 +'<label for="'+attrs.ngModel+'">' + attrs.placeholder + '</label>'
20                                 +'<input type="'+my_type+'" name="'+attrs.ngModel+'" ng-model="' + attrs.ngModel + '" ng-required="' + attrs.ngRequired + '" placeholder="' + attrs.placeholder + '" />'
21                                 +'</div>'
22                         ;
23                         element.replaceWith(html);
24                 }
25     };
26   });