MD Ghouse MD Ghouse - 1 year ago 128
AngularJS Question

Uncaught Error: [$injector:modulerr]

Here im trying to use Autocomplete textbox using angularJs when im loading my view its throughing an error as "Uncaught Error: [$injector:modulerr] "

**Html Code*

<div ng-controller="ngAutoCompleteController">
<div angucomplete-alt id="txtAutocomplete" placeholder="Type country name" pause="100"
selected-object="afterSelectedCountry" local-data="Employees" search-fields="Name"
title-field="Name" minlength="1" input-class="form-control" match-class="highlight">


<div ng-show="SelectedCountry">
Selected Country : {{SelectedCountry.Employees}}
<script src=""></script>
<link href="" rel="stylesheet" />
<script src=""></script>
<link href="~/Content/angucomplete-alt.css" rel="stylesheet" />
<style type="text/css">
.angucomplete-dropdown {
overflow-y: auto;
max-height: 200px;


var app = angular.module('myApp', ['angucomplete-alt']);
app.controller('ngAutoCompleteController', ['$scope', '$http', function ($scope, $http) {
$scope.Employees = [];
$scope.SelectedCountry = null;

//After select country event
$scope.afterSelectedCountry = function (selected) {
alert('Enter in Control autocom')

if (selected) {
$scope.SelectedCountry = selected.originalObject;

//Populate data from database
method: 'GET',
url: '/home/GetCountries'
}).then(function (data) {
$scope.Employees =;}]);

mvc controller

public JsonResult GetCountries(){
var x =( from n in db.Employees orderby n.Name select n).ToList();return new JsonResult { Data = x, JsonRequestBehavior = JsonRequestBehavior.AllowGet };}

Answer Source

You need to refer the corresponding angucomplete-alt.js in the view,

<script src=""></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download