Skip to content

Instantly share code, notes, and snippets.

@kazekagegaara
Created January 14, 2015 21:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kazekagegaara/51b72bf5b1a8ceb9f90d to your computer and use it in GitHub Desktop.
Save kazekagegaara/51b72bf5b1a8ceb9f90d to your computer and use it in GitHub Desktop.
Ionic UL search example
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Sample UL</title>
<link href="http://code.ionicframework.com/0.9.22/css/ionic.css" rel="stylesheet">
<script src="http://code.ionicframework.com/0.9.22/js/ionic.js"></script>
<script src="http://code.ionicframework.com/0.9.22/js/angular/angular.min.js"></script>
<script src="http://code.ionicframework.com/0.9.22/js/angular/angular-animate.min.js"></script>
<script src="http://code.ionicframework.com/0.9.22/js/angular/angular-sanitize.min.js"></script>
<script src="http://code.ionicframework.com/0.9.22/js/angular-ui/angular-ui-router.min.js"></script>
<script src="http://code.ionicframework.com/0.9.22/js/ionic-angular.js"></script>
</head>
<body ng-controller="sampleController">
<header-bar title="'Sample UL'" type="bar-positive"></header-bar>
<content has-header="true" padding="true" scroll="false">
<button class="button button-block button-positive">
Sample Button
</button>
<div style="height:250px">
<label class="item item-input">
<i class="icon ion-search placeholder-icon"></i>
<input type="text" placeholder="Search" ng-model="searchText">
</label>
<scroll direction="y">
<ul class="list">
<li ng-repeat="data in sampleData | filter:searchText">{{data.key}}</li>
</ul>
</scroll>
</content>
</body>
</html>
angular.module('ionicApp', ['ionic','sampleController'])
angular.module('sampleController', [])
.controller('sampleController', function($scope,$ionicScrollDelegate) {
$scope.sampleData = [{'key':'one'},
{'key':'two'},
{'key':'three'},
{'key':'four'},
{'key':'five'},
{'key':'six'},
{'key':'seven'},
{'key':'eight'},
{'key':'nine'},
{'key':'ten'},
{'key':'eleven'},
{'key':'twelve'}];
$scope.$watch('searchText',function(value){
console.log(value);
});
$ionicScrollDelegate.scrollTop(false);
})
.directive('scrollBackListToTop', function() {
return function (scope, element, attrs) {
console.log(element);
};
});
body {
cursor: url('http://ionicframework.com/img/finger.png'), auto;
}
.scroll-view
{
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment