I have a directive to show a symbol depending on the value of a field. This is attached to a field as follows:
<input type="text" placeholder="" class="text-input" ng-class="example_class" ng-model="exmaple-model" my-directive />
And a directive as follows:
module.directive("myDirective", function () {
return {
require: "?ngModel",
link: function (scope, element, attrs, ngModelCtrl) {
/*breakpoints show the line above and below are reached*/
ngModelCtrl.$parsers.push(function (val) {
/* call to function to show symbol, this line is never reached */
}
The code is reaching the ngModelCtrl line, but reaches no further. Debugging has shown that while the ngModelCtrl looks to be built correctly (has functions and values, etc.) the $parsers is empty - the length is 0, the functions that should be there aren't.
Looking at the Chrome inspector yields no errors. Are there any reasons for the $parsers to be blank, or is there a way to debug the directive any further?