gambler
gambler

Reputation: 67

getting Uncaught Error: [$injector:modulerr] in angular js

I am trying to create a basic from as below.

<head>
    <meta charset="utf-8" />
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.min.js"></script>
    <script src="lib/jquery-1.12.1.min.js"></script>
    <script src="js/homepage.js"></script>

</head>

<body ng-app="BasicHttpAuthExample">

<div id="userController" ng-controller="userController">
    <form novalidate class="simple-form">
        Name: <input type="text" ng-model="user.name" /><br />
        E-mail: <input type="email" ng-model="user.email" /><br />
        Gender: <input type="radio" ng-model="user.gender" value="male" />male
        <input type="radio" ng-model="user.gender" value="female" />female<br />
        <input type="button" ng-click="reset()" value="Reset" />
        <input type="submit" ng-click="update(user)" value="Save" />
    </form>
</div>

and my javascript code is

var loginAppModule = angular.module('loginApp', []);

loginAppModule.controller('userController',function($scope){
    $scope.alertValues  = function(){
        alert($scope.name);
    }
});

When i am trying to run, i am getting "Uncaught Error: [$injector:modulerr]".

I am new to angular js. Please somebody help me.

Upvotes: 0

Views: 64

Answers (2)

surya surakhman
surya surakhman

Reputation: 1

May be you can try this

var loginAppModule = angular.module('BasicHttpAuthExample', []);

Upvotes: 0

Tummala Krishna Kishore
Tummala Krishna Kishore

Reputation: 8271

You are using the wrong app module ,

In your Js file you are using loginApp

but in your HTML you are using BasicHttpAuthExample

Try to keep only one in sync with HTML and JS

Upvotes: 2

Related Questions