5

I have tried to do the following:

<accordion-heading ng-click="doSomething(); isopen=!isopen">

Should this work? or is it not possible to string there call together?

ng-click="doThis(param); doThat(param);"

I just need pointed in the right direction :-)

EDIT:

this:

ng-click="doThis(param); doThat(param);"

works as expected, I think it is:

isopen=!isopen

that is causing the problem, I realise I didn't say this initially.

I go around this by adding an extra div into the accordion heading, like this:

<accordion-heading ng-click="isopen=!isopen">
    <div ng-click="showMainView()">
        <i class="glyphicon" ng-class="{'glyphicon glyphicon-minus': isopen, 'glyphicon glyphicon-plus': !isopen}"></i>
        {{item.model}}<br>{{item.model_engine}}
    </div>
</accordion-heading> 
0

2 Answers 2

3

possible !! possible !! possible !! possible !! possible

You can call multiple functions with ';'

See here

Using ng-click to call two different functions

How to add many functions in ONE ng-click?

How to use ng-click with multiple expressions?

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

Comments

1

It works:

http://plnkr.co/edit/fwSdBT3NIBrlk80aTgaB?p=preview

However be careful not to do too much logic in there. You should put the logic in the controller and only call it from the view. (isopen = !open for example doesn't belong on the view)

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.