Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
am working with angularjs in visual studio 2013.my index page is working fine with angularjs but not working along with my controller file and my module file.please help resolve it

1. index.html
XML
<!DOCTYPE html>
<html ng-app="myApp" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

</head>
<body>
    <div>
        <input type="text"  ng-model="firstName" />
        <p>{{firstName}}</p>
    </div>

    <script src="Scripts/angular-resource.js"></script>
    <script src="Scripts/angular-route.js"></script>
    <script src="Scripts/jquery-1.10.2.js"></script>
    <script src="Scripts/bootstrap.js"></script>
    <script src="Scripts/angular.js"></script>
    <script src="Scripts/myCtrl.js"></script>
    <script src="Scripts/myApp.js"></script>
</body>
</html>



2. myApp.js
C#
var app = angular.module("myApp", []);



3. myCtrl.js
PHP
app.controller("myCtrl", function ($scope) {
    $scope.firstName = "olawale";
}
);
Posted
Comments
Schatak 26-Aug-15 9:44am    
what error you are getting?

1 solution

Try this

app.controller('myCtrl', ['$scope', function ($scope) {
$scope.firstName = 'olawale';
}]);
 
Share this answer
 
Comments
John C Rayan 1-Sep-15 4:17am    
Hi

If you are happy with the solution can you mark the answer as accepted to enable it to be closed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900