Reputation: 959
<!DOCTYPE html>
<html ng-app>
<head>
<script data-require="angular.js@*" data-semver="1.4.3" src="https://code.angularjs.org/1.4.3/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="MainController">
<h1>This is the message {{message}}</h1>
</body>
</html>
and my script file has
var MainController = function($scope) {
$scope.message = "Hi this is great ";
};
but still the result is showing {{message}} and not the actual message
Upvotes: 0
Views: 61
Reputation: 883
HTML Code :
<!DOCTYPE html>
<html ng-app="demo">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css" />
<script data-require="[email protected]" src="https://code.angularjs.org/1.4.3/angular.js" data-semver="1.4.3"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainController">
<p>This is the message {{message}}</p>
</body>
</html>
And script.js
var app = angular.module('demo', []);
app.controller('MainController', function ($scope) {
$scope.message = "Hi this is great ";
});
Working example Plunker Example
Upvotes: 0
Reputation: 1186
Here is a working example:
<body ng-app="myApp">
<div ng-controller="MainController">
Hello, {{message}}!
</div>
</body>
var myApp = angular.module('myApp',[]);
var MainController = function($scope) {
$scope.message = "Hi this is great ";
}
http://jsfiddle.net/sinaidoron/1c12r4hr/1/
Upvotes: 3