javascript - AngularJS: How to access input[date] min attribute within custom directive? -
i'm trying write access of <input type="date"
min attribute within custom directive value. know input[date] element directive to. https://docs.angularjs.org/api/ng/input/input%5bdate%5d access $(elem).attr('min') not right way. how can access input[date] min attribute within directive?
jsfiddle here: http://jsfiddle.net/musuk/lbbtyjod/
as per directive:
use attrs.mydirective
access minvalue inside directive link function. access min date: attrs.min
, set min date attrs.$set('min', '2015-03-02')
.directive("mydirective", function(){ return { require: 'ngmodel', scope: { minvalue: "=mydirective" }, link: function(scope, element, attrs) { scope.$watch('minvalue', function(){ console.log(attrs.mydirective); // set min here attrs.$set('min', '2015-03-02'); }); } }; });
Comments
Post a Comment