2

So I use this code like filter to buttons:

<input value="Type1" ng-click="typeF = {type: 'Type1'}" type="button"/>
<input value="Type2" ng-click="typeF = {type: 'Type2'}" type="button"/>
<input value="Type3" ng-click="typeF = {type: 'Type3'}" type="button"/>
<input value="Type4" ng-click="typeF = {type: 'Type4'}" type="button"/>
<input value="All" ng-click="typeF = null" type="button"/>

And output data by filtering like this:

<tr ng-repeat="product in products | filter:search | filter:someN | filter:typeF">
    <td>{{product.name}}</td>
    <td>{{product.type}}</td>
    <td>{{product.someNvalue}}</td>
</tr>

But I need to use this kind of filter too:

<input ng-repeat="product in products | unique:'soneNvalue'" value="{{product.soneNvalue}}" ng-click="$parent.someN = {someNvalue: '{{product.someNvalue}}'}" type="button" >

ng-click is doing something, but I dod get any output, my list just disapears and all. I use $parent scope but it doesnt help much. Can anyone please help :)

1
  • Can you make a live demo? (with JSfiddle for exemple) Commented Sep 19, 2014 at 13:56

1 Answer 1

4

Please see here http://jsbin.com/muvagexabuto/1/edit

you don't have to interpolate {{product.someNvalue}} inside ng-click

<input ng-repeat="product in products |unique:'soneNvalue'"  ng-value="product.someNvalue" 
ng-click="$parent.someN = {someNvalue: product.someNvalue}" 
type="button" >
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. At first it didnt work, but I changet now the value to ng-value, and before when I removed the interpolate I left these ' ' and removing them it worked like charm. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.