bigbadwolf
bigbadwolf

Reputation: 63

ng-click function parameters not making it to handler (AngularJs)

This is the sample code I have:

<a ng-click="$parent.infoLinkClickHandler('hard-param', car.engineSize)">{{ car.engineSize }}</a></li>

And in the handler:

$scope.infoLinkClickHandler = function(param1, param2) {
// do something here
        };

param1, the hard-coded parameter is there

param2, is undefined

On the markup, {{ car.engineSize }} prints as expected.

Any ideas?

Thanks!

Upvotes: 0

Views: 18

Answers (1)

Mike Park
Mike Park

Reputation: 1985

It would seem that the scope inside the attribute ng-click is different to that inside the {{}}.

Is the HTML shown the exact HTML, or have you simplified it for the question?

Upvotes: 1

Related Questions