angularjs - angular - ngModelController $formatters won't trigger. -
hey guys i'm having trouble wrapping head around ngmodelcontroller.
i have directive:
app.directive('emailvalidation', function () { return { restrict: 'a', require: 'ngmodel', link: function (s, e, a, c) { c.$parsers.push(function (value) { return value.tolowercase(); }); c.$formatters.push(function (value) { if (value) { return value.touppercase(); } }); s.$watch('user.email', function () {}); } }; });
this is. $parsers work! minute type input lowercase. after goes through validation pipe. done! , can see i'm trying output upper case view still shown parser return
the html looks this.
<form name='email' novalidate> <input type='text' name='email' placeholder='email address' data-ng-model='user.email' required email-validation /> </form>
i'm pretty sure i'm missing need please help. in advance.
Comments
Post a Comment