Angularjs - ng-model undefined
问题 I am building a rather complex directive in which I need access to ng-model on a specific element in the template which is enclosed into ng-if directive... I have a plunker and the explanation on how to see the issue is below. In the .compile function of the directive I have a line of code that looks like this ngModel = elm.find('textarea').controller('ngModel'); console.log(ngModel); In my template, I have a something like this: <div ng-if="views.view"> <textarea ng-model="exp.val"><