LoginSignup
5
5

More than 5 years have passed since last update.

Angularのコントローラ間通信

Last updated at Posted at 2014-04-16

AngularでコントローラAからBのメソッドをたたく方法。

xxxx
//コントローラA側
 cotrollerA =  function($scope,$rootScope)
{
    $rootScope.$broadcast('hogehoge');
}

//コントローラB
controllerB = function($scope,$rootScope)
{
    //ブロードキャストを受け取る
  $scope.$on('hogehoge',function(event,data)
  {
     //もちろん$scopeにアクセス可能
  });
}
5
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5