Created
October 29, 2016 18:59
-
-
Save comzeradd/fe00217b0821508b1cd892b55a276713 to your computer and use it in GitHub Desktop.
render a json and filter out
This file contains 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 lang="en" ng-app="mail"> | |
<head> | |
<title>Mail Data</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
</head> | |
<body> | |
<div ng-view ng-controller="mailsCtrl"> | |
<form role="search"> | |
<input type="text" placeholder="type to filter" ng-model="search"> | |
</form> | |
<div ng-repeat="mail in data | filter:search"> | |
{{ mail }} | |
</div> | |
</div> | |
<script src="jquery.min.js"></script> | |
<script src="angular.min.js"></script> | |
<script> | |
var mail = angular.module('mail', []); | |
mail.controller('mailsCtrl', function ($scope, $http) { | |
$http.get('data.json').success(function(data) { | |
$scope.data = data; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment