If I add two controller I get following error:

Uncaught Error: [$injector:modulerr] 
http://errors.angularjs.org/1.4.7/$injector/modulerr?p0=myApp&p1=Error%3A%2…%20(http%3A%2F%2Flocalhost%3A56696%2Fangularjs%2Fangular.min.js%3A19%3A463)


<script src="angularjs/angular.min.js"></script>
<script 
src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js";></script>
<script src="scripts/office.js"></script>
<script src="scripts/namectrl.js"></script>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml";>

<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body ng-app="myApp">
    <section>
        <div ng-controller="myCtrl">
            <label>Full Name: {{firstName + " " + sirName}}</label>
            <!--label>Hello {{person.first}} + ' ' + {{person.second}} 
<label-->
            <div>
                First Name: <input type="text" ng-model="firstName">

                <div ng-controller="namectrl">
                    Sir Name : <input type="text" ng-model="sirName"><br />
                    <br>
                </div>
            </div>
            
            <button ng-click="sendName()">Submit</button>
        </div>
    </section>
</body>
</html>

I have two controllers in two different files:
office.js
var app = angular.module('myApp', ["mySharedElements"]);
app.controller('myCtrl', function ($scope, $http) {
});


namectrl.js
// JavaScript source code
var app = angular.module('myApp', ["mySharedElements"]);
app.controller('namectrl', function ($scope, $http) {

});

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to