{"id":21300,"date":"2016-03-21T12:30:00","date_gmt":"2016-03-21T12:30:00","guid":{"rendered":"http:\/\/cloudcomputing.sys-con.com\/node\/3731133"},"modified":"2016-03-21T12:30:00","modified_gmt":"2016-03-21T12:30:00","slug":"implementing-the-mediator-design-pattern-in-angular-2-by-yfain-cloudexpo-cloud","status":"publish","type":"post","link":"https:\/\/icloud.pe\/blog\/implementing-the-mediator-design-pattern-in-angular-2-by-yfain-cloudexpo-cloud\/","title":{"rendered":"Implementing the Mediator Design Pattern in Angular 2 By @YFain | @CloudExpo #Cloud"},"content":{"rendered":"<p>In any component-based framework you\u2019ll need to implement component communications. The main principle is that components should be loosely coupled hence reusable hence testable. The mediator design pattern allows you to arrange component communications via \u201cthe man in the middle\u201d so a component A never communicates with the component B directly. If a component needs data, someone will provide the data via bindings to the component\u2019s input properties. Who\u2019s this someone?Ain\u2019t no business of the component. If a component needs to provide some data to the external world, it\u2019ll emit events (with the data payload). Emits to whom? Ain\u2019t no business of the component. Let whoever needs the data listen to the events from this component.<\/p>\n<p><a href=\"http:\/\/cloudcomputing.sys-con.com\/node\/3731133\" >read more<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In any component-based framework you&rsquo;ll need to implement component communications. The main principle is that components should be loosely coupled hence reusable hence testable. The mediator design pattern allows you to arrange component communications via &ldquo;the man in the middle&rdquo; so a component A never communicates with the component B directly. If a component needs data, someone will provide the data via bindings to the component&rsquo;s input properties. Who&rsquo;s this someone?Ain&rsquo;t no business of the component. If a component needs to provide some data to the external world, it&rsquo;ll emit events (with the data payload). Emits to whom? Ain&rsquo;t no business of the component. Let whoever needs the data listen to the events from this component.<\/p>\n<p><a href=\"http:\/\/cloudcomputing.sys-con.com\/node\/3731133\" target=\"_blank\">read more<\/a><\/p>\n","protected":false},"author":143,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-21300","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts\/21300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/users\/143"}],"replies":[{"embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/comments?post=21300"}],"version-history":[{"count":1,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts\/21300\/revisions"}],"predecessor-version":[{"id":21301,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts\/21300\/revisions\/21301"}],"wp:attachment":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/media?parent=21300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/categories?post=21300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/tags?post=21300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}