(feat) added new sg-placeholder directive for dynamic placeholders

pull/105/head
Ludovic Marcotte 2015-09-03 13:25:44 -04:00
parent acfa96263b
commit 0bdbe5bbac
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() {
'use strict';
/**
* sgPlaceholder - A directive for dynamic placeholder
* @memberof SOGo.Common
* @ngInject
* @example:
<input type="text"
sg-placeholder="this_is_a_variable" />
*/
function sgPlaceholder() {
return {
restrict: 'A',
scope: {
placeholder: '=sgPlaceholder'
},
link: function(scope, elem, attr) {
scope.$watch('placeholder',function() {
elem[0].placeholder = scope.placeholder;
});
}
};
}
angular
.module('SOGo.Common')
.directive('sgPlaceholder', sgPlaceholder);
})();