angularjs - Using $routeParams inside ng-repeat filter -


i'm trying pass $routeparams value filter ng-repeat data. here controller:

myapp.controller('bookctrl', ['$scope', '$routeparams' function($scope, $routeparams) {     $http.get('books.json').success(function(data) {         $scope.books = data;         $scope.slug = $routeparams.slug;     }); }]); 

and html:

<div class="container" role="document" ng-repeat="book in books | filter:{slug: {{slug}}}">     <p>{{book.title}}</p> </div> 

is possible this? try above code, returned syntax error:

http://errors.angularjs.org/1.4.1/$parse/syntax?p0=

problem fixed:

<div class="container" role="document" ng-repeat="book in books | filter:{slug:  slug }"> 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -