Skip to content

Instantly share code, notes, and snippets.

@superchris
Created May 4, 2015 21:58
Show Gist options
  • Save superchris/a7ffd5cef94c9de37655 to your computer and use it in GitHub Desktop.
Save superchris/a7ffd5cef94c9de37655 to your computer and use it in GitHub Desktop.
JS Bin http example // source http://jsbin.com/yecas
<!DOCTYPE html>
<html ng-app="githubApp">
<head>
<meta name="description" content="http example" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-controller="RepoCtrl as ctrl">
<input ng-model="ctrl.repoName" />
<input type="button" value="Search" ng-click="ctrl.search()" />
<ul>
<li ng-repeat="repo in ctrl.repos">{{repo.name}}</li>
</ul>
<script id="jsbin-javascript">
var githubApp = angular.module("githubApp", []);
githubApp.controller("RepoCtrl", function($http) {
this.search = function() {
var that = this;
$http.get("https://api.github.com/search/repositories?q=" + this.repoName).success(function(repos) {
that.repos = repos.items;
});
};
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">var githubApp = angular.module("githubApp", []);
githubApp.controller("RepoCtrl", function($http) {
this.search = function() {
var that = this;
$http.get("https://api.github.com/search/repositories?q=" + this.repoName).success(function(repos) {
that.repos = repos.items;
});
};
});
</script></body>
</html>
var githubApp = angular.module("githubApp", []);
githubApp.controller("RepoCtrl", function($http) {
this.search = function() {
var that = this;
$http.get("https://api.github.com/search/repositories?q=" + this.repoName).success(function(repos) {
that.repos = repos.items;
});
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment