Skip to content

Instantly share code, notes, and snippets.

@joeriks
Created September 26, 2014 13:03
Show Gist options
  • Select an option

  • Save joeriks/df64c143802b6839ad70 to your computer and use it in GitHub Desktop.

Select an option

Save joeriks/df64c143802b6839ad70 to your computer and use it in GitHub Desktop.
tapas live search with angularjs
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<style>
ul {padding-left:0}
li {list-style-none;margin-bottom:10px;}
</style>
<script>
angular.module('liveSearchModule', [])
.controller('SearchCtrl', function ($scope,$http) {
$http.get('/umbraco/publishedcontent/nodes/getdescendantsorself?url=/')
.success(function(data){$scope.children = data;});
});
</script>
<div ng-app="liveSearchModule" ng-controller="SearchCtrl">
<h1>Live search</h1>
<input id="searchText" type="search" placeholder="live search..." ng-model="searchText" />
<ul ng-if="searchText">
<li ng-repeat="child in children | filter: searchText | limitTo: 10">
<a href="{{child.Url}}">{{child.Name}}</a>
<div ng-bind-html-unsafe="child.Properties.excerpt"></div>
</li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment