Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- directive('loginForm', function(){
- return {
- restrict: 'AC',
- link: function(scope, el){
- jQuery(el).find(".form-group:has(label)").each(function(i, el)
- {
- var $this = angular.element(el),
- $label = $this.find('label'),
- $input = $this.find('.form-control');
- $input.on('focus', function()
- {
- $this.addClass('is-focused');
- });
- $input.on('keydown', function()
- {
- $this.addClass('is-focused');
- });
- $input.on('blur', function()
- {
- $this.removeClass('is-focused');
- if($input.val().trim().length > 0)
- {
- $this.addClass('is-focused');
- }
- });
- $label.on('click', function()
- {
- $input.focus();
- });
- if($input.val().trim().length > 0)
- {
- $this.addClass('is-focused');
- }
- });
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement