Skip to content

AngularJS directive to make Material like placeholder element.

License

Notifications You must be signed in to change notification settings

tsanko/angular-input-placeholder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

angularjs-input-placeholder

AngularJS directive to make Meterial like placeholder element. This will solve the problem IE9 not honoring HTML5 placeholder attribute ;). It will inject and overlay a label so this solution will work with password field too.

Extra functionality: Short text will be used (if defined) when input has focus.

USAGE

<div class="row" >
  <input ng-model="username" type="text"
         ng-placeholder="Address Line #1"
         ng-placeholder-short="Address" />
</div>

CSS

.row {
    position: relative;
    ...
}

.placeholder {
	position: absolute;
	color: #aaa; /* HTML5 placeholder color */
	top: XXpx;   /* depends on input height */
	left: XXpx;  /* depends on input padding */
	line-height: XXpx; /* depends on input's font size */
	cursor: text;
	/* set font size */
}

.placeholder.-selected {
	/* add transition */
	top: -10px;
	text-align: right;
	/* adjust font size  and color*/
}

.placeholder.-focus {
	/* adjust font size  and color*/
}	

About

AngularJS directive to make Material like placeholder element.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published