Created
September 26, 2014 13:03
-
-
Save joeriks/df64c143802b6839ad70 to your computer and use it in GitHub Desktop.
tapas live search with angularjs
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
| <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