You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>The chain-of-responsibility pattern is a design pattern consisting of a source of command objects and a series of processing objects. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain. A mechanism also exists for adding new processing objects to the end of this chain.

832
832
833
-
As stated above the scopes in an AngularJS application form a hierarchy known as the scope chain. Some of the scopes are "isolated", which means that they don't inherit prototypically by their parent scope, but are connected to it via their `$parent`property.
When `$emit`or`$broadcast`are called we can think of the scope chain as event bus, or even more accurately chain of responsibilities. Once the event is triggered it is emitted downwards or upwards (depending on the method, which was called). Each subsequent scope may:
-Handle the event and pass it to the next scope in the chain
838
-
-Handle the event and stop its propagation
839
-
-Pass the event to the next scope in the chain without handling it
840
-
-Stop the event propagation without handling it
837
+
-イベントを処理し、次のスコープに渡す
838
+
-イベントを処理し、そこで伝播を止める
839
+
-イベントを処理せず、次のスコープに渡す
840
+
-イベントを処理せず、そこで伝播を止める
841
841
842
-
In the example bellow you can see an example in which `ChildCtrl` triggers an event, which is propagated upwards through the scope chain. In the case above each of the parent scopes (the one used in `ParentCtrl` and the one used in `MainCtrl`) are going to handle the event by logging into the console: `"foo received"`. If any of the scopes should be considered as final destination it can call the method `stopPropagation` of the event object, passed to the callback.
0 commit comments