Bonjour,
J'ai un contrôleur parent et deux fils :
HTML :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 app.controller("ParentController", function($scope){ $scope.showbloc = function(param){ if (param == 1) Fils1.clearform(); else Fils2.clearform(); } } app.controller("Fils1Controller", function($scope){ $scope.clearform = function(param){ // do something } } app.controller("Fils2Controller", function($scope){ $scope.clearform = function(param){ // do something } }
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <div ng-controller="ParentController"> <a ng-click="showbloc(1)">Fils 1</a> <a ng-click="showbloc(2)">Fils 2</a> <div ng-controller="Fils1Controller"> <input type="text" /> </div> <div ng-controller="Fils2Controller"> <input type="text" /> </div> </div>
Ce que je veux c'est exécuter une fonction d'un contrôleur fils depuis un contrôleur parent si vous pouvez m'aider.
Partager