Skip to content

Instantly share code, notes, and snippets.

@cguldogan
Created February 28, 2016 00:17
Show Gist options
  • Save cguldogan/bbf0e02c99332b0098eb to your computer and use it in GitHub Desktop.
Save cguldogan/bbf0e02c99332b0098eb to your computer and use it in GitHub Desktop.
Angular Get
<!doctype html>
<html ng-app='myApp'>
<head>
<title>Simple Angular.Js Get Sample Snippet</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0-beta.1/angular.min.js"></script>
<script>
angular.module('myApp', []).controller('myCtrl', function ($scope, $http) {
$scope.hello = {};
$scope.newName = "";
$scope.Get = function() {
$http.get($scope.newName).success(function(data, status) {
$scope.hello = data;
})
}
})
</script>
</head>
<body>
<div ng-controller="myCtrl">
{{hello}}
<form ng-submit="Get()">
Url: <input ng-model="newName"/>
<button type="submit">Get</button>
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment