In my application, I call the http service to get the data, and I use the angular -ui bootstrap typeahead directive (ui-bootstrap-tpls-0.6.0.min.js). I have a partial one that takes the form that the controller mentions and includes the partial inside ng-repeat. This second partial is of type.
The main form is partial:
<form
id="myform"
name="myform"
onsubmit="javascript: return false"
enctype="application/json"
ng-controller="EducationCollegeCtrl">
// doing other stuff
...
<div ng-if="model.hasData">
<div ng-repeat="college in model.academicRecords" ng-form="collegeForm">
<div ng-include="'resources/appc/modules/main/education/components/collegetype.all.html'"></div>
</div>
</div>
// other stuff going on here
collegetype.all.html:
....
<label for="institution">Institution name:</label>
<div>
<input type="text" ng-model="college.organizationName" typeahead="item.name for item in matchingInstitutions($viewValue)>
</div>
....
EducationCollegeCtrl.js:
angular.module('theApp',['ui.bootstrap']).controller('EducationCollegeCtrl', function ($scope, $http) {
...
$scope.matchingInstitutions = function(partialName) {
return $http.get('lookup/institutions?name=' + partialName ).then(function(response){
return response.data.institutions;
});
};
...
The service is called and the drop-down menu is displayed correctly with the name of the institutions. But in the browser console, I see an error below for each entry in the drop-down list
console.log:
Error: No controller: ngModel
at Error (<anonymous>)
at getControllers (/resources/lib/angular/1.1.5/angular.js:4899:39)
at nodeLinkFn (/resources/lib/angular/1.1.5/angular.js:5040:55)
at compositeLinkFn (/resources/lib/angular/1.1.5/angular.js:4626:37)
at nodeLinkFn (/resources/lib/angular/1.1.5/angular.js:5033:40)
at compositeLinkFn (/resources/lib/angular/1.1.5/angular.js:4626:37)
at publicLinkFn (/resources/lib/angular/1.1.5/angular.js:4531:46)
at ngRepeatAction (/resources/lib/angular/1.1.5/angular.js:15638:33)
at Object.$watchCollectionAction (/resources/lib/angular/1.1.5/angular.js:8867:29)
at Object.applyFunction [as fn] (<anonymous>:778:50) <typeahead-match index="$index" match="match" query="query" template-url="templateUrl" class="ng-isolate-scope ng-scope"> angular.js:6422
, 'required' , , angular, , , ng-model . ?
EDIT: URL.