Created
October 1, 2015 14:20
-
-
Save matthewbednarski/8626f6aad20b19e19bf5 to your computer and use it in GitHub Desktop.
A bootstrap-datepicker angular directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
var app = angular.module("siDate", []) | |
.directive('datePicker', [datePicker]); | |
function datePicker() { | |
return { | |
restrict: 'EA', //E = element, A = attribute, C = class, M = comment | |
replace: true, | |
scope: { | |
//@ reads the attribute value, = provides two-way binding, & works with functions | |
name: '@', | |
placeholder: '@', | |
date: '=?' | |
}, | |
template: '<input class="datepicker form-control" ' + | |
' name="{{ name }}" ng-model="date" ' + | |
' placeholder="{{ placeholder }}" ' + | |
' required/>', | |
link: function($scope, element, attrs) { | |
} //DOM manipulation | |
}; | |
} | |
})(window.jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment