This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Error showing inaccurate causes: Error: [$compile:ctreq] Controller 'ngModel', required by directive 'ngClick', can't be found! #7062
Milestone
This short fiddle http://jsfiddle.net/x3EtD/7/ shows errors in the console, but they are indicating a problem that doesn't exist. Namely, that the 'ngClick' directive requires 'ngModel' which it doesn't. There seems to be a bug with the way angular is filling in the blanks for this error message.
The problem in this case is that a custom directive that requires ngModel has been created for all input elements, but the checkbox in the example doesn't have one. Ironically, it doesn't actually break any functionality but spews out misleading errors in the console. Changing
requires: 'ngModel'
torequires: '?ngModel'
takes care of the error in the fiddle.Tracking this down was difficult as the errors pointed so explicitly to a problem with my use of ng-click rather than the real culprit.
I suspect that the error should say
Error: [$compile:ctreq] Controller 'ngModel', required by directive 'input', can't be found!
OS: Ubuntu 12.04
Browsers: Chromium 33, Firefox 28
Angular versions tested: 1.2.1, 1.2.15
The text was updated successfully, but these errors were encountered: