UNPKG

acha-framework

Version:

is a modular framework on both client (angular.js) and server (node.js) side, it provides security, orm, ioc, obfuscation and ...

55 lines 1.74 kB
(function ($, angular, underscore, window, document, undefined) { 'use strict'; angular.module('frontend.directives').directive('textbox', [function () { return { restrict: 'E', replace: true, scope: { tag: '<?', disabled: '=?', visible: '=?', cssClass: '=?', placeHolder: '=?', placeHolderTranslate: '=?', prependIcon: '=?', appendIcon: '=?', label: '=?', labelTranslate: '=?', model: '=?', onChanged: '<?', readonly: '=?' }, templateUrl: '/templates/framework/directives/textbox/template.html', link: function (scope, element, attr) { scope.vm = {}; scope.vm.init = function () { if (angular.isUndefined(scope.disabled)) { scope.disabled = false; } if (angular.isUndefined(scope.visible)) { scope.visible = true; } if (angular.isUndefined(scope.cssClass)) { scope.cssClass = ''; } if (angular.isUndefined(scope.readonly)) { scope.readonly = false; } scope.vm.bind(); }; scope.vm.bind = function () { scope.$watch('model', function (val, old) { if (val === undefined || val === null) { scope.model = ''; return; } if (angular.isFunction(scope.onChanged)) { scope.onChanged(scope.model, scope.tag, old); } }); }; scope.vm.init(); } }; }]); }(jQuery, angular, _, window, document));