Created
September 17, 2023 19:47
-
-
Save ggorlen/56dd931ea7dba8d4aaaeefa22094ec8f to your computer and use it in GitHub Desktop.
AngularJS hello world
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta name="color-scheme" content="dark light" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.js"></script> | |
</head> | |
<body> | |
<div ng-app="exampleApp"> | |
<test-component></test-component> | |
</div> | |
<script> | |
angular.module("exampleApp", []) | |
.component("testComponent", { | |
template: ` | |
<div> | |
{{greeting}} | |
</div> | |
`, | |
restrict: "E", | |
controllerAs: "$ctrl", | |
controller: "testComponentCtrl", | |
}) | |
.controller("testComponentCtrl", function($scope) { | |
const ctrl = this; | |
$scope.greeting = "hello world"; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment