user3414662 user3414662 - 5 months ago 28
AngularJS Question

Why my Plunker Angular JS is not working?

Can someone tell me why the hell this plunker is not working?
Sample AngularJS on Plunker

HTML :

<!DOCTYPE html>
<html>

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.min.js"></script>
<script src="script.js"></script>
</head>

<body ng-controller="MyCtrl">
<p>{{userData}}</p>
</body>

</html>


JavaScript:

var app = angular.module('myApp', []);
app.controller('MyCtrl', function ($scope) {
$scope.userData = {
name: 'Xavier',
age: 25
}
});

Answer

you forgot to put ng-app.

<html ng-app="myApp">
Comments