Here is a simple example of an AngularJS application. This code will display a greeting and a button that, when clicked, will change the greeting:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js"></script> <script> // Define an AngularJS module var app = angular.module('myApp', []); // Define a controller for the module app.controller('myCtrl', function($scope) { $scope.greeting = 'Hello'; $scope.changeGreeting = function() { $scope.greeting = 'Hola'; }; }); </script> </head> <body ng-app="myApp" ng-controller="myCtrl"> <h1>{{ greeting }}</h1> <button ng-click="changeGreeting()">Change greeting</button> </body> </html>
This code will display “Hello” on the page, and when the button is clicked, the greeting will change to “Hola”.