2014. 9. 25. 10:15
[angular] $broadcast, $emit, $on AngularJS 2014/09/12 17:26
출처: http://blog.naver.com/suy6107/220119971824
$broadcast
==> 부모 컨트롤러에서 자식 컨트롤러로 이벤트를 방송
$emit
==> 자식 컨트롤러에서 부모 컨트롤러로 이벤트 방송
$on
==> 방송한 이벤트를 받는다.
<부모>
$scope.$broadcast("parentToChildEvent", args); //자식에게 방송
<자식>
$scope.$on("parentToChildEvent", function(event, args) {
//이벤트 처리
});
<자식>
$scope.$emit("childToParentEvent", args); //부모에게 방송
<부모>
$scope.$on("childToParentEvent", function(event, args) {
//이벤트 처리
});
'.NET > 스크립트 + JQuery' 카테고리의 다른 글
자바스크립트 Date 자료형 MS 자료 (0) | 2015.01.15 |
---|---|
[AngularJS] 모듈 및 컨트롤러 통합. (0) | 2014.10.25 |
JQuery Ajax 공식문서 (287) | 2014.03.07 |
제이쿼리 UI 공식 싸이트 (0) | 2014.01.07 |
[스크랩] 인터넷 창 닫기 이벤트 처리 (0) | 2013.03.18 |