{"id":400,"date":"2015-04-13T11:33:22","date_gmt":"2015-04-13T11:33:22","guid":{"rendered":"https:\/\/ionic.io\/blog\/?p=400"},"modified":"2016-10-05T11:16:14","modified_gmt":"2016-10-05T11:16:14","slug":"angular-2-series-components","status":"publish","type":"post","link":"https:\/\/ionic.io\/blog\/angular-2-series-components","title":{"rendered":"Angular 2 Series: Components"},"content":{"rendered":"<p><em>README: Angular 2 has changed significantly since this post was written. As such, please do not use this code verbatim. Instead, focus on the concepts below and then map them to the new syntax and API of Angular 2.0.0.<\/em><\/p>\n<p>Welcome to the second post in our series on Angular 2. If you missed the first post, check out the quick <a href=\"https:\/\/ionic.io\/blog\/angular-2-series-introduction\/\" title=\"Angular 2 Series: Introduction\">Intro to Angular 2<\/a>.<\/p>\n<p>In this post, we are going to talk about Components, which elegantly replace the mix of controllers, scopes, and directives from Angular 1.<br \/>\n<!--more--><\/p>\n<h3>The death of scope<\/h3>\n<p>If you missed Igor and Tobias&#8217; <a href=\"https:\/\/www.youtube.com\/watch?v=gNmWybAyBHI\">great talk<\/a> at ngEurope in October, they quite dramatically proclaimed the death of a variety of Angular 1 concepts, including controllers and <code>$scope<\/code>. I was there, I and remember the gasps and nervous laughter from the crowd as a series of ominous gravestones flashed on the screen:<\/p>\n<p><a href=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png\"><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png\" alt=\"RIP Angular 1\" width=\"274\" height=\"300\" class=\"alignnone size-medium wp-image-401 lazyload\" data-srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png 274w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-936x1024.png 936w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png 940w\" data-sizes=\"auto, (max-width: 274px) 100vw, 274px\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" style=\"--smush-placeholder-width: 274px; --smush-placeholder-aspect-ratio: 274\/300;\" \/><noscript><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png\" alt=\"RIP Angular 1\" width=\"274\" height=\"300\" class=\"alignnone size-medium wp-image-401\" srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png 274w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-936x1024.png 936w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png 940w\" sizes=\"auto, (max-width: 274px) 100vw, 274px\" \/><\/noscript><\/a><\/p>\n<p>The uproar from the broader community was immediate, with <a href=\"http:\/\/www.reddit.com\/r\/programming\/comments\/2kl88s\/angular_20_drastically_different\/\">scathing comments<\/a>, <a href=\"http:\/\/eisenbergeffect.bluespire.com\/leaving-angular\/\">high-profile departures<\/a>, and plenty of <a href=\"http:\/\/codebetter.com\/johnvpetersen\/2014\/10\/27\/how-google-broke-the-oss-compact-with-angular-2-0\/\">overly-dramatic banter<\/a> to make it really exciting.<\/p>\n<p>Though it made for good TV, the reaction was unwarranted. Those new to Angular 2 quickly see how the new component model is a lot easier to use than what we had in v1.<\/p>\n<h3>The &#8220;Component&#8221;<\/h3>\n<p>Angular 1 wasn&#8217;t built around the concept of components. Instead, we&#8217;d attach controllers to various parts of the page with our custom logic. Scopes would be attached or flow through, based on how our custom directives encapsulated themselves (isolate scope, anyone?).<\/p>\n<p>I don&#8217;t really know how to describe the model in v1, but it wasn&#8217;t like any other hierarchical system I&#8217;ve ever used. We&#8217;d just &#8220;attach&#8221; behaviors to various parts of our page and then have to deal with the complicated meta-structure created by our directives, controllers, and scopes.<\/p>\n<p>To add logic to the page, we&#8217;d have to decide between building a controller or a custom directive.<\/p>\n<p>In version 2, Angular drops all of this for a much cleaner, more object-oriented Component model.<\/p>\n<h3>Our first component<\/h3>\n<p>If you&#8217;ve ever written Java, C#, or any other language with strong OO patterns, you&#8217;ll immediately understand a component. It&#8217;s just a class that represents an element on the screen, with member-data that influences the way it looks and behaves.<\/p>\n<p>Just like a <code>JComponent<\/code> subclass in Java (Swing), or a <code>Control<\/code> subclass in Windows Forms development.<\/p>\n<p>Let&#8217;s see an example:<\/p>\n<pre><code class=\"javascript\">\nimport {Component} from &#039;@angular\/core&#039;\n\n@Component({\n  selector: &#039;my-component&#039;,\n  template: &#039;&lt;div&gt;Hello my name is {{name}}&lt;\/div&gt;&#039;\n})\n\nexport class MyComponent {\n  constructor() {\n    this.name = &#039;Max&#039;\n  }\n  sayMyName() {\n    console.log(&#039;My name is&#039;, this.name)\n  }\n}\n<\/code><\/pre>\n<p>This creates a new component called <code>MyComponent<\/code>, which will be identified in markup as <code>&lt;my-component&gt;<\/code>, just like <code>restrict: &#039;E&#039;<\/code> did in v1.<\/p>\n<p>We can specify a template for the component with the <code>template<\/code> property in <code>@Component<\/code> annotation (annotations are an es6 extension added by both AtScript and TypeScript, though only TypeScript will be relevant going forward).<\/p>\n<h3>Member data<\/h3>\n<p>If we look closer at the example above, we don&#8217;t see <code>$scope<\/code> anywhere. Instead, we see <code>this.name = &#039;Max&#039;<\/code>, and a member function (&#8220;method&#8221;) called <code>sayMyName()<\/code>. If you&#8217;re familiar with <a href=\"http:\/\/toddmotto.com\/digging-into-angulars-controller-as-syntax\/\">Controller As<\/a> syntax in v1, the use of <code>this<\/code> will look familiar to you.<\/p>\n<p>Even so, this is different. When our component is &#8220;instantiated&#8221; and rendered on the page, we have an instance of our component. We can modify the instance data of that component, call methods on it, and pass it around to other components. It&#8217;s just an object!<\/p>\n<p>More tangibly, imagine we have a <code>Button<\/code> component. The component has a <code>this.title<\/code> for the text of the button, and a click handler. Previously, we&#8217;d either build a new <code>directive<\/code> for the button, maybe add an isolate scope with some events and two-way data bindings, or get lazy and just attach a controller to it (or one of its parents). With Angular 2 components, we get a natural combination of all of these concepts: our Component has encapsulated instance data (much like isolate scopes), event handlers (much like methods attached to scopes), and a template (much like directives).<\/p>\n<p>We can even inherit from other components or attach components through attributes, and access parents and siblings (more on that in a future post). This is a far easier, less error-prone way to replace <code>require<\/code> from directives in v1.<\/p>\n<h3>ngApp?<\/h3>\n<p>In the previous post, we briefly mentioned the bootstrap process, the process by which an Angular 2 app powers itself up. In v1, we had <code>ng-app<\/code>, or we could manually bootstrap. In v2, there isn&#8217;t an <code>ng-app<\/code>. Instead, we provide our own root Component from which we want to start the app:<\/p>\n<pre><code class=\"html\">&lt;app&gt;&lt;\/app&gt;\n<\/code><\/pre>\n<p>which would look like this as a v2 component:<\/p>\n<pre><code class=\"javascript\">\n@Component({ \n  selector: &#039;app&#039;,\n  templateUrl: &#039;main.html&#039;\n })\n\nclass MyApp {\n  constructor() {\n    console.log(&#039;App Start&#039;)\n  }\n}\n\nbootstrap(MyApp)\n<\/code><\/pre>\n<p>What we&#8217;d often see in Angular 1 was <code>ng-app<\/code> and <code>ng-controller<\/code> used on the same element, like this:<\/p>\n<pre><code class=\"html\">&lt;body ng-app=&quot;myspace&quot; ng-controller=&quot;AppCtrl&quot;&gt;\n<\/code><\/pre>\n<p>Then, our <code>AppCtrl<\/code> would create some root scope data that our child controllers would access and\/or extend.<\/p>\n<p>In v2, we get all of that in one Component.<\/p>\n<p>I really like this change. If you think about your document layout, it&#8217;s really just a tree. The root shouldn&#8217;t be any different than every other element, even though it was in v1.<\/p>\n<p>With the change to the component model, we need to change our mindset a bit. Instead of attaching our custom logic to the page with controllers, we put that logic into components. If we want a certain part of the page needs business logic, we create a new component for it. If we are using an existing component but want to attach behavior to it, we can extend it.<\/p>\n<h3>Annotations<\/h3>\n<p>Let&#8217;s dig in a bit to the <code>@Component<\/code> annotation above. If you recall, these are extensions on ES6, which are becoming part of TypeScript which Angular 2 will use.<\/p>\n<p>Basically, these annotations allow us to attach information to our component. We can configure the selector our Component will look for to instantiate itself (like <code>&lt;my-component&gt;<\/code>), and also set the template.<\/p>\n<p><code>@Component<\/code> is the core annotation, and has a few important parameters:<\/p>\n<pre><code class=\"javascript\">@Component({\n  selector: &#039;my-component&#039;,\n  providers: [MyService],\n  \/\/ Url based template\n  templateUrl: &#039;main.html&#039;,\n\n  \/\/ Inline template\n  template: `\n    &lt;div&gt;\n      &lt;button&gt;&lt;\/button&gt;\n      &lt;ng-content&gt;&lt;\/ng-content&gt;\n    &lt;\/div&gt;\n  `,\n  directives: [Button],\n})\n<\/code><\/pre>\n<p>The <code>selector<\/code> param is the replacement for the auto-naming system of directives in v1 and is now explicit: you must set it to exactly what you want the new component to be named in markup. It works much like <code>querySelector<\/code>.<\/p>\n<p>The <code>providers<\/code> param is part of the new Dependency Injection system, and configures which services we want to inject into our component (more on this in a later post).<\/p>\n<p>We can use provide a template either inline, using <code>template<\/code>, or point to an external file using <code>templateUrl<\/code>. This similar to how we defined templates for custom directives in Angular 1. Notice the use of the awesome <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/template_strings\">new backtick Template strings<\/a> in ES6 that let us easily create multi-line templates!<\/p>\n<p>We also reference the child directives we want to enable so they are compiled and instantiated (I hope this changes in the future so you don&#8217;t have to explicitly specify child directives).<\/p>\n<p>Finally, we should note the <code>&lt;ng-content&gt;&lt;\/ng-content&gt;<\/code> tag in our template. This is the new &#8220;ngTransclude&#8221; and specifies where child content will be injected. You can have multiple ones and target different spots to include child content (more on this in the future!)<\/p>\n<h3>Conclusion<\/h3>\n<p>A lot is changing in Angular 2, and few things as dramatically as the way we build and specify components on the page.<\/p>\n<p>Though it&#8217;s scary to move on from our beloved scopes, controllers, and directives (concepts that we worked so hard to learn and learn to love), it&#8217;s really a wonderful thing. With the new component model, Angular is moving into much more familiar OO territory, and is setting itself up to work with the future of web standards, like Web Components and Shadow DOM.<\/p>\n<p>Once you get used to the new model, it&#8217;s hard to go back. I think the community will learn to embrace the changes and appreciate how they make Angular 2 so much better.<\/p>\n<p>In our next post, we will talk about &#8220;New-way&#8221; data binding: the untimely death of 2-way data binding! Stay tuned.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>README: Angular 2 has changed significantly since this post was written. As such, please do not use this code verbatim. Instead, focus on the concepts below and then map them to the new syntax and API of Angular 2.0.0. Welcome to the second post in our series on Angular 2. If you missed the first [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[2,3,4],"class_list":["post-400","post","type-post","status-publish","format-standard","hentry","category-all","tag-angularjs","tag-ionic","tag-top-posts"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Angular 2 Series: Components - Ionic Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ionic.io\/blog\/angular-2-series-components\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular 2 Series: Components\" \/>\n<meta property=\"og:description\" content=\"README: Angular 2 has changed significantly since this post was written. As such, please do not use this code verbatim. Instead, focus on the concepts below and then map them to the new syntax and API of Angular 2.0.0. Welcome to the second post in our series on Angular 2. If you missed the first [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ionic.io\/blog\/angular-2-series-components\" \/>\n<meta property=\"og:site_name\" content=\"Ionic Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-13T11:33:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-10-05T11:16:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png\" \/>\n<meta name=\"author\" content=\"Max Lynch\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@maxlynch\" \/>\n<meta name=\"twitter:site\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Max Lynch\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#article\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components\"},\"author\":{\"name\":\"Max Lynch\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/91f360cffbd804a464b0c4a87b5c5f1e\"},\"headline\":\"Angular 2 Series: Components\",\"datePublished\":\"2015-04-13T11:33:22+00:00\",\"dateModified\":\"2016-10-05T11:16:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components\"},\"wordCount\":1267,\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png\",\"keywords\":[\"angularjs\",\"Ionic\",\"Top Posts\"],\"articleSection\":[\"All\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components\",\"url\":\"https:\/\/ionic.io\/blog\/angular-2-series-components\",\"name\":\"Angular 2 Series: Components - Ionic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png\",\"datePublished\":\"2015-04-13T11:33:22+00:00\",\"dateModified\":\"2016-10-05T11:16:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ionic.io\/blog\/angular-2-series-components\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png\",\"width\":940,\"height\":1028},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ionic.io\/blog\/angular-2-series-components#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ionic.io\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Angular 2 Series: Components\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ionic.io\/blog\/#website\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"name\":\"ionic.io\/blog\",\"description\":\"Build amazing native and progressive web apps with the web\",\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ionic.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ionic.io\/blog\/#organization\",\"name\":\"Ionic\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"width\":1920,\"height\":854,\"caption\":\"Ionic\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ionicframework\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/91f360cffbd804a464b0c4a87b5c5f1e\",\"name\":\"Max Lynch\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/05\/max-avatar-150x150.jpg\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/05\/max-avatar-150x150.jpg\",\"caption\":\"Max Lynch\"},\"description\":\"CEO\",\"sameAs\":[\"http:\/\/twitter.com\/maxlynch\",\"https:\/\/x.com\/maxlynch\"],\"url\":\"https:\/\/ionic.io\/blog\/author\/max\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Angular 2 Series: Components - Ionic Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ionic.io\/blog\/angular-2-series-components","og_locale":"en_US","og_type":"article","og_title":"Angular 2 Series: Components","og_description":"README: Angular 2 has changed significantly since this post was written. As such, please do not use this code verbatim. Instead, focus on the concepts below and then map them to the new syntax and API of Angular 2.0.0. Welcome to the second post in our series on Angular 2. If you missed the first [&hellip;]","og_url":"https:\/\/ionic.io\/blog\/angular-2-series-components","og_site_name":"Ionic Blog","article_published_time":"2015-04-13T11:33:22+00:00","article_modified_time":"2016-10-05T11:16:14+00:00","og_image":[{"url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png"}],"author":"Max Lynch","twitter_card":"summary_large_image","twitter_creator":"@maxlynch","twitter_site":"@ionicframework","twitter_misc":{"Written by":"Max Lynch","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#article","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components"},"author":{"name":"Max Lynch","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/91f360cffbd804a464b0c4a87b5c5f1e"},"headline":"Angular 2 Series: Components","datePublished":"2015-04-13T11:33:22+00:00","dateModified":"2016-10-05T11:16:14+00:00","mainEntityOfPage":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components"},"wordCount":1267,"publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"image":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png","keywords":["angularjs","Ionic","Top Posts"],"articleSection":["All"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ionic.io\/blog\/angular-2-series-components","url":"https:\/\/ionic.io\/blog\/angular-2-series-components","name":"Angular 2 Series: Components - Ionic Blog","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage"},"image":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16-274x300.png","datePublished":"2015-04-13T11:33:22+00:00","dateModified":"2016-10-05T11:16:14+00:00","breadcrumb":{"@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ionic.io\/blog\/angular-2-series-components"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#primaryimage","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/04\/Screenshot-2015-04-02-16.51.16.png","width":940,"height":1028},{"@type":"BreadcrumbList","@id":"https:\/\/ionic.io\/blog\/angular-2-series-components#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ionic.io\/blog"},{"@type":"ListItem","position":2,"name":"Angular 2 Series: Components"}]},{"@type":"WebSite","@id":"https:\/\/ionic.io\/blog\/#website","url":"https:\/\/ionic.io\/blog\/","name":"ionic.io\/blog","description":"Build amazing native and progressive web apps with the web","publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ionic.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ionic.io\/blog\/#organization","name":"Ionic","url":"https:\/\/ionic.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","width":1920,"height":854,"caption":"Ionic"},"image":{"@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ionicframework"]},{"@type":"Person","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/91f360cffbd804a464b0c4a87b5c5f1e","name":"Max Lynch","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/05\/max-avatar-150x150.jpg","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/05\/max-avatar-150x150.jpg","caption":"Max Lynch"},"description":"CEO","sameAs":["http:\/\/twitter.com\/maxlynch","https:\/\/x.com\/maxlynch"],"url":"https:\/\/ionic.io\/blog\/author\/max"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":0,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/400\/revisions"}],"wp:attachment":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media?parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/categories?post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/tags?post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}