screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myController" class="container"> <h3>Angular Js Generate Random Number</h3> <button ng-click="randomNumber()">Generate Random Number</button> <p >Random Number: {{generatedNumber}}</p> </div> <script> angular.module("myApp", []).controller("myController", function ($scope, $window) { $scope.randomNumber = function() { $scope.generatedNumber = Math.floor($window.Math.random() * 100) + 1; }; }); </script> <style> body { background-color: #f2f2f2; font-family: Arial, sans-serif; } .container { max-width: 500px; margin: 0 auto; padding: 20px; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } h3 { font-size: 24px; margin-bottom: 20px; color: #333; } button { background-color: #4CAF50; color: white; border: none; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; border-radius: 4px; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #45a049; } p { font-size: 18px; color: #333; margin-top: 20px; } </style> </body> </html>