Skip to content

Simple AngularJS directive to show/hide a label for form elements (aka floating label) using CSS3 animations and flexbox.

License

Notifications You must be signed in to change notification settings

thegitfather/angular-flabel

Repository files navigation

Simple Angular directive to show/hide a label

Description

Currently supported elements are input[type='text/email/password/number'], select and textarea.

So what is cool about it?

  • label and form element are both animated and are NOT positioned absolute (meaning the label will stay in the normal document flow)
  • very simple (happy extending)

Preview

demo gif

Demo

Plunker: embedded view / edit

Install

Bower:

$ bower install angular-flabel --save

Usage

Inject the directive into your app:

var app = angular.module('app', ['thegitfather.flabel']);

Add flabel directive to a form element:

<div class="form-group">
  <input id="normalTextInput" type="text" class="form-control"
    placeholder="Email address (e.g. [email protected])"
    name="normalTextInput"
    required
    ng-model="normalTextInput1"
    flabel="Your Email" />
</div>

The form element should be enclosed by some kind of container (e.g. <div class="form-group">...</div>). You also need to specify a model (ng-model="..."). If the flabel attribute contains no string then the text from placeholder will be used.

Develop

Just fork or clone this repo, then:

$ cd angular-flabel && npm install

If your project is using bower and your clone is outside your project directory, you can use $ bower link🔗

If you installed gulp globally just run $ gulp watch or $ gulp build. Otherwise type $ npm start to use the locally installed gulp to start the watch task.

About

Simple AngularJS directive to show/hide a label for form elements (aka floating label) using CSS3 animations and flexbox.

Resources

License

Stars

Watchers

Forks

Packages

No packages published