0

When I attempt to pass a value from ng-repeat into a function it seems to read the data literally from the text put in , whereas I would like to pass the values in....

            <li ng-repeat="event in filtered = (events | filter:query) | orderBy:'-event_date'" >

                <div class="event-info">
                    <strong>{{event.event_name}}</strong><br />

                </div>

                <div ng-click="prepare_edit('{{event.event_name}}')" >EDIT</div>
            </li>

Controller:

$scope.prepare_edit = function(event_name) {

        window.alert(event_name);
    }

OUTPUTS: {{event.event_name}} , whereas I would like the actual value

1 Answer 1

1

You don't need to use braces {{}} in ng-click. If you have put "event" var inside $scope you can just use it.

 <div ng-click="prepare_edit(event.event_name)" >EDIT</div>

Here is a FIDDLE

Sign up to request clarification or add additional context in comments.

Comments

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.