I want to access the ngModelController in the linking function. I am using $compile to generate the html dynamically based on the user options. as per the docs I need to return the linking function from compileFunction.
but the linking function is not getting called. Plunker Link
I am trying to restrict user from entering alphabets when type=number.
EDIT
var compileFunction = function (element) {
return function (scope, telem, tattr, ngModelCtrl) {
console.log(ngModel);
var template = helper.getFieldHtml(fieldHtml, scope.options);
element.html(template);
$compile(element.contents())(scope);
return linkFunction.apply(scope, telem, tattr, ngModel);
};
};
return {
scope: { options: '=', ngModel: '=' },
required: ['ngModel', '^form'],
restrict: 'E',
compile: compileFunction
};
how to I access ngModelCtrl in the link function.. returned from compile function