0

I am new to angularJS and nodeJS and am working on a project. As it stands there exists two different controllers let's say "controllerA" and "controllerB" that have "functionA" and "functionB" being triggered by ng-click events on "buttonA" and "buttonB".

If I want to trigger functionA and functionB from one "buttonC", how would I do that?

Thanks!

Manish
  • 4,692
  • 3
  • 29
  • 41
Evan
  • 51
  • 5

1 Answers1

0

Just call controllers on two different divs

<div ng-controller="controllerA">
 <div ng-controller = "controllerB">
  <input ng-click="functionA();functionB();"/>
 </div>
</div>

OR

call one controller controllerA in your routes for your view. and call another controller controllerB in your view.

.state('app.example', {
  url: '/example',
  controller: 'controllerA',
  templateUrl: 'example.html',
})

<div ng-controller="controllerB">
  <input ng-click="functionA();functionB();"/>
</div>

By this, you can access two controllers