AngularJS Dependency Injection
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script> </head> <body> <script> angular.module('diApp', []) .controller('UserController', function($scope, $http) { $http.get('/api/users').then(function(response) { $scope.users = response.data; }); }); </script> </body> </html>