Skip to content
This repository was archived by the owner on Nov 25, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

<div ng-controller="MainController">
<form>
<p><input floating-label type="text" placeholder="First Name" id="first-name"></p>
<p><label for="last-name">Last Name</label><input floating-label type="text" placeholder="Last Name" id="last-name"></p>
<p><textarea floating-label placeholder="Address" id="address"></textarea></p>
<p><input floating-label type="text" placeholder="First name" id="first-name" ng-model="firstName"></p>
<p><label for="last-name">Last Name</label><input floating-label type="text" placeholder="Last Name" id="last-name" ng-model="lastName"></p>
<p><textarea floating-label placeholder="Address for {{firstName}} {{lastName}}" id="address"></textarea></p>
<p><input type="text" value="blank" /></p>
</form>
</div>
Expand Down
7 changes: 7 additions & 0 deletions lib/angular-floating-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
link: function(scope, el, args) {
var options = scope.options();
el.floatingLabel(options);

var label = $('label[for="' + el.attr('id') + '"]');

args.$observe('placeholder', function(value) {
label.text(value);
});

}
};
}]);
Expand Down