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/

demo

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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -