I'm using the Angular-Leaflet Directive and trying to figure out how to filter the markers using data from a input text box and the data property of the marker object. Everything I try results in an angular infinite digest loop.
This is what I have so far:
var app = angular.module('mapApp', ['leaflet-directive']);
//Filter
$scope.filterTerm;
//Controller
app.controller("mapController", ['$scope', function ($scope) {
$scope.center = {
lat: 53.4239,
lng: -7.9407,
zoom: 7
};
//declare sample points
$scope.samplePoints = [
{
lat: 53.37,
lng: -9.48,
data : 'K',
hidden: true
},
{
lat: 54.2314131,
lng: -8.5744558,
data: 'L',
hidden: true
}
];
}]);
And the html
<input type="text" ng-model="filterTerm" />
<leaflet center="center" markers="markers| markers="markers | filter: filterTerm " style="height: 900px;"></leaflet>
I've used this Stack Overflow answer, and have been trying for hours but everything I try gets the same error. Help greatly appreciated.