-1

I have the follow code:

 <li class='' ng-click="changeStatus('hello', '{{result.name}}')">

Where 'hello' is my first parameter for changeStatus and I want to pass of binded result.name's value as the second parameter. Does anyone know how to accomplish this?

I tried {{result.name}}, '{{results.name}}' but neither seems to work.

There is probably something simple that am I missing?


I took a look at: Can you pass parameters to an AngularJS controller on creation?

but both the parameters in ng-init were string literals.

Community
  • 1
  • 1
Ninja
  • 1,012
  • 3
  • 14
  • 29
  • What exactly is `result`? Can you please clarify? Why couldn't you use something like `$scope.result.name` in your `changeStatus` function, like I mentioned in my answer? – kelsier Sep 24 '14 at 04:16

3 Answers3

3

You don't have to pass it. You could just access it in your controller using :

$scope.result.name

kelsier
  • 4,050
  • 5
  • 34
  • 49
  • 1
    +1. You are possibly right. however, but I suspect `result` is not a direct property of `$scope` because its being used in a `
  • `. May be its an item in `$scope.results`
  • – Mohayemin Sep 24 '14 at 04:10
  • @Mohayemin Had put a question to the OP. – kelsier Sep 24 '14 at 04:18