KSNoob KSNoob - 2 months ago 6
AngularJS Question

Confirming if AngularJS is installed and working

Just following an AngularJS book to read and learn , he has created a test page like this:

<!DOCTYPE HTML>
<html ng-app>
<head>
<title> First App </title>
<script src="angular.js"></script>
<link href="bootstrap.css" rel="stylesheet"/>
<link href="bootstrap-theme.css" rel="stylesheet"/>
</head>
<body>
<div class="btn btn-default">{{AngularJS}}</div>
<div class = "btn btn-success">Bootsrap</div>
</body>
</html>


but when I go to the URL of the page at:
http://localhost:5000/test.html


I see a page like this, notice the text is missing from the first button.
Does that mean Angular is not setup correctly?

enter image description here

Here is also a file to connect to server I think, that's what I have:

var connect = require('connect'),
serveStatic = require('serve-static');

var app = connect();

app.use(serveStatic("../angularjs"));
app.listen(5000);

Answer

Yes it is correct. You can see in the developer tools and Console will show you if there are errors any. Just add single quotes inside the {{'AngularJs'}}. Look below

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<!DOCTYPE HTML>
<html ng-app>
<head>
<title> First App </title>
<script src="angular.js"></script>
<link href="bootstrap.css" rel="stylesheet"/>
<link href="bootstrap-theme.css" rel="stylesheet"/>
</head>
<body>
<div class="btn btn-default">{{'AngularJS'}}</div>
<div class = "btn btn-success">Bootsrap</div>
</body>
</html>