I'm trying to create basic angular app and it throws an error
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script type="text/javascript">
var angularApp = angular.module('angularApp', []);
angularApp.controller('Ctrl', function($scope) {});
</script>
</head>
<body>
<div ng-app ng-controller="Ctrl"></div>
</body>
</html>
Error:
Error: [ng:areq] http://errors.angularjs.org/1.4.3/ng/areq?p0=Ctrl&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:6:416
at Sb (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:22:18)
at Qa (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:22:105)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:79:497
at x (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:59:501)
at S (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:60:341)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:54:384)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:53:444
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js:19:481'
What I did wrong?
You must give ng-app
the name of your app:
<div ng-app="angularApp" ng-controller="Ctrl"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With