Skip to content

Instantly share code, notes, and snippets.

@ggorlen
Created September 17, 2023 19:47
Show Gist options
  • Save ggorlen/56dd931ea7dba8d4aaaeefa22094ec8f to your computer and use it in GitHub Desktop.
Save ggorlen/56dd931ea7dba8d4aaaeefa22094ec8f to your computer and use it in GitHub Desktop.
AngularJS hello world
<!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