📄 Understanding the AngularJS <script> Tag
Learn how to properly include AngularJS in your HTML file and why it matters.
The <script> tag is used to include the AngularJS library into your HTML page. Without this script, AngularJS directives and features like data binding, controllers, and modules won't work.
✅ Typical AngularJS Script Tag (CDN):
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>
- ✔️ Load Order Matters: Always load AngularJS before your custom scripts (like
app.js). - ✔️ Use a Specific Version: Avoid using latest/unstable versions; specify exact version (e.g., 1.8.3).
- ✔️ CDN vs Local: For development, CDN is fine. For production, consider bundling or hosting locally.
📁 Sample Usage in HTML:
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title>AngularJS Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>
<script src="app.js"></script>
</head>
<body>
<div>
<input ng-model="name" placeholder="Enter your name">
<h2>Hello {{name}}</h2>
</div>
</body>
</html>


