Reputation: 11595
I am unable to get binding to work. I am not sure what I am doing wrong. When I attempt to display the value of the header on the page, the page generated is "{{name}}" instead of "My App".
Here is the code:
<!DOCTYPE HTML>
<html ng-app="appModule">
<head ng-controller="appController">
<meta name="viewport" content="width=device-width" />
<title>Home</title>
<script src="~/Views/Scripts/angular.js"></script>
<script>
/// <reference path="~/Views/Scripts/angular.js" />
var appModule = angular.module("appModule", []);
appModule.controller("appController", function ($scope)
{
$scope.name = "My App";
});
</script>
</head>
<body ng-controller="appController">
<div>
<h1>{{name}}</h1>
</div>
</body>
</html>
Upvotes: 0
Views: 535
Reputation: 366
I got it working by loading angular directly from google CDN, so the error might be in the loading of angular
See here: http://jsfiddle.net/9JyX6/
<html ng-app="appModule">
<head ng-controller="appController">
<title>Home</title>
<script>
/// <reference path="~/Views/Scripts/angular.js" />
var appModule = angular.module("appModule", []);
appModule.controller("appController", function ($scope)
{
$scope.name = "My App";
});
</script>
</head>
<body ng-controller="appController">
<div>
<h1>{{name}}</h1>
</div>
</body>
</html>
Upvotes: 1