Last active
December 14, 2015 15:08
-
-
Save hotienvu/5105501 to your computer and use it in GitHub Desktop.
My custom directive to 2 way-bind the size attribute of <select>. The issue is open here
https://github.com/angular/angular.js/issues/1619
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
myApp.directive('ngSize', function() { | |
return { | |
restrict:'A', | |
scope: { | |
ngSize: '=' | |
}, | |
link: function(scope, elem, attrs) { | |
scope.$watch("ngSize", function(newVal, oldVal) { | |
angular.element(elem).attr('size', newVal); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using an isolated scope does not work when using ng-options. Use this instead: