Sunday, 15 April 2012

javascript - Skip filter for the first time during onload angularjs -



javascript - Skip filter for the first time during onload angularjs -

is there way skip filter first time ? during onload

here html

<div ng-repeat="style in styles"> <input type="checkbox" ng-model="style.selected"> {{style.name}} </div> <div ng-repeat="tour in tours | filter: hasstyle">name: {{tour.tourname}}

angular js

angular.module('myapp', []) .controller('mycontroller', function($scope){ $scope.styles = [{"name":"walking"},{"name":"food"},{"name":"culture"}]; $scope.tours = [{"tourname":"sky walk","style":"walking "},{"tourname":"accra markets","style":"food,walking"}]; $scope.hasstyle = function(item){ homecoming $scope.styles.some(function(style){ if(style.selected && item.style.indexof(style.name) > -1) { homecoming true; } }) } });

objective :

i using refine search results displaying , first time want load results .i want skip filter or other improve way display results first time ?

here plunker

javascript angularjs

No comments:

Post a Comment