0

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.

1
  • I think you are referring the wrong app module as your app module is loginApp so replace the code ng-app="BasicHttpAuthExample" with ng-app="loginApp" and try. Commented Mar 22, 2016 at 4:11

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

May be you can try this

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.