Created
February 28, 2016 00:17
-
-
Save cguldogan/bbf0e02c99332b0098eb to your computer and use it in GitHub Desktop.
Angular Get
This file contains hidden or 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 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