Tuesday, November 8, 2016

Solved: Angular 1 - Error: [$compile:ctreq] http://errors.angularjs.org/1.5.8/$compile/ctreq?p0=ngModel&p1=ngOptions

If you receive this error message:

 Error: [$compile:ctreq] http://errors.angularjs.org/1.5.8/$compile/ctreq?p0=ngModel&p1=ngOptions


It might be that you haven't added ng-model directive to the select tag you're trying to populate with ng-options.

This code will produce the error above:

<select ng-options="item.id as item.id for item in organizations">
</select>

The solution is simple addition of ng-model directive , like this:


<select ng-model="mychoice"  ng-options="item.id as item.id for item in organizations">
</select>

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...