{"id":5645,"date":"2015-06-30T16:15:11","date_gmt":"2015-06-30T13:15:11","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=5645"},"modified":"2015-06-27T23:30:49","modified_gmt":"2015-06-27T20:30:49","slug":"angular2-hello-world","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/","title":{"rendered":"[Angular2]=&#8221;{{&#8216;Hello, World!&#8217;}}&#8221;"},"content":{"rendered":"<p>As I mentioned in my recent <a href=\"http:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-2-hello-world\/\">blog post <\/a>Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically. Angular 2 looks like a completely different framework: no <em>DDO<\/em>, no <em>$scope<\/em>, no <em>angular.module<\/em> and completely rewritten binding and change detection (no <em>ng-model<\/em>).<\/p>\n<p>Although Angular 2 is still work in progress many new features have already been revealed. In this blog post I will share some basic concepts of the framework via code samples that I presented during my lecture at InfoShare 2015.<\/p>\n<p>Please note the code is created with <a href=\"https:\/\/github.com\/angular\/angular\/releases\/tag\/2.0.0-alpha.26\" target=\"_blank\">Angular 2 Alpha 26<\/a>.<\/p>\n<h2>Angular 2 is built with\u2026 TypeScript (1.5)<\/h2>\n<p>TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.<\/p>\n<p>We could say it is ECMAScript 6 on steroids, as it offers what ECMAScript 6 has to offer. But it adds many more features: type checking, interfaces, generics, enums or decorators to name just a few.<\/p>\n<p>Let\u2019s see some sample code created in TypeScript:<\/p>\n<pre class=\" brush:php\">import {Greeter} from \"greeter\";\r\n\r\nclass HtmlGreeter implements Greeter {\r\n\r\n    constructor(public greeting:string) {\r\n    }\r\n\r\n    greet() {\r\n        return \"&lt;h1&gt;\" + this.greeting + \"&lt;\/h1&gt;\";\r\n    }\r\n}\r\n\r\nvar greeter = new HtmlGreeter(\"Hello, world!\");\r\nvar greetings = greeter.greet();<\/pre>\n<p>TypeScript is optional for Angular 2 applications and although it is a recommended approach, developers have choice. They can choose from: ES5, ES6, CoffeScript or any other language that compiles to JavaScript.<\/p>\n<p>Want to learn more about TypeScript? Visit <a href=\"http:\/\/www.typescriptlang.org\/\" target=\"_blank\">http:\/\/www.typescriptlang.org\/<\/a><\/p>\n<h2>Hello, World!<\/h2>\n<p>Let\u2019s see two \u201cHello, World!\u201d Angular 2 applications written in TypeScript and ECMAScript 5 accordingly.<\/p>\n<p>TypeScript (1.5):<\/p>\n<pre class=\" brush:php\">\/\/ TypeScript\r\nimport {Component, View, bootstrap} from 'angular2\/angular2';\r\n\r\n@Component({\r\n    selector: 'hello-angular2'\r\n})\r\n@View({\r\n    template: \"&lt;h1&gt;Hello {{ name | lowercase }}&lt;\/h1&gt;\"\r\n})\r\nclass HelloAngular2Cmp {\r\n    name:string = \"Angular2\";\r\n}\r\n\r\nbootstrap(HelloAngular2Cmp);<\/pre>\n<p>JavaScript (ES5):<\/p>\n<pre class=\" brush:php\">\/\/ ES5\r\nfunction HelloAngular2Cmp() {\r\n    this.name = 'Angular2'\r\n}\r\n\r\nHelloAngular2Cmp.annotations = [\r\n    new angular.ComponentAnnotation({\r\n        selector: 'hello-angular2'\r\n    }),\r\n    new angular.ViewAnnotation({\r\n        template: '&lt;h1&gt;Hello, {{ name }}!&lt;\/h1&gt;'\r\n    })\r\n];\r\n\r\ndocument.addEventListener('DOMContentLoaded', function () {\r\n    angular.bootstrap(HelloAngular2Cmp);\r\n});<\/pre>\n<p>As you can see the TypeScript version is a bit less verbose and decorators (<em>@<\/em>) clearly separate the code from meta data information.<\/p>\n<h2>Angular 2 Building Blocks<\/h2>\n<p>As you could notice, the the above code did not contain much of what you learned about Angular 1.x: no angular.module, no Directive Definition Object (DDO), no $scope.<\/p>\n<h2>Component<\/h2>\n<p>A component is the main UI building block of Angular 2 app: Angular 2 is a tree of components. Every Angular 2 application must have at least one component. A component class is an execution context for the template or it is a <em>component controller<\/em>. A component requires a single <code>@Component<\/code> decorator and at least one <code>@View<\/code> decorator.<\/p>\n<p>Let\u2019s see a really basic component in Angular 2:<\/p>\n<pre class=\" brush:php\">@Component({\r\n    selector: 'hello-angular2'\r\n})\r\n@View({\r\n    templateUrl: 'template.html',\r\n    directives: [NgIf]\r\n})\r\nclass HelloAngular2Cmp {\r\n\r\n    private text:string;\r\n    private clickCount:number = 0;\r\n\r\n    onClick(input, $event) {\r\n        this.text = input.value;\r\n        if ($event instanceof MouseEvent) {\r\n            this.clickCount++;\r\n        }\r\n    }\r\n}\r\n\r\n\/\/ let component be rendered on a page\r\nbootstrap(HelloAngular2Cmp);<\/pre>\n<p><code>HelloAngular2Cmp<\/code> has two properties: <code>text<\/code> and <code>clickCount<\/code> that are bound to a view defined by a template attribute of a <code>@View<\/code> decorator. Templates have access to any properties or functions of a component controller.<\/p>\n<h2>View<\/h2>\n<p>The template itself looks like this:<\/p>\n<pre class=\" brush:php\">&lt;!-- local variable input --&gt;\r\n&lt;input type=\"text\" #input&gt;\r\n&lt;!-- event binding --&gt;\r\n&lt;button (click)=\"onClick(input, $event)\"\r\n        [disabled]=\"text === 'Angular2'\"&gt;Click me!&lt;\/button&gt;\r\n\r\n&lt;!-- property binding --&gt;\r\n&lt;p&gt;Angular2 says: {{ text }}&lt;\/p&gt;\r\n\r\n&lt;!-- Conditional --&gt;\r\n&lt;div *ng-if=\"clickCount &gt;= 5\"&gt;Clicking too much, man!&lt;\/div&gt;<\/pre>\n<p>The syntax is very easy:<\/p>\n<ul>\n<li><code>{{ expression | pipe }}<\/code> &#8211; Angular 2 interpolation,<\/li>\n<li><code>#variable<\/code> \u2013 local variables available in the scope of the component. The variable can be later referred in the component\u2019s template,<\/li>\n<li><code>(event)<\/code> &#8211; binding to events of element or directive,<\/li>\n<li><code>[property]<\/code> &#8211; binding to properties of element.<\/li>\n<\/ul>\n<h2>Bindings<\/h2>\n<p>Every time the <code>text<\/code> property of a component changes, the change is automatically reflected in the template. The properties of elements are accessed with square brackets (<code>[property]<\/code>) syntax. In the above example the button will be disabled once the <code>text<\/code> property of a component is equal to \u201cAngular 2\u201d. This is a property binding in Angular 2.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8R3J1dXc1LVA5bk0.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-5650\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8R3J1dXc1LVA5bk0.png\" alt=\"0B0b09VuqaAG8R3J1dXc1LVA5bk0\" width=\"715\" height=\"394\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8R3J1dXc1LVA5bk0.png 715w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8R3J1dXc1LVA5bk0-300x165.png 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/a><\/p>\n<p>To propagate changes from DOM to a component event binding must be utilized. Event bindings in Angular 2 are represented by brackets syntax: <em>(event)<\/em>. In the above example when a click event occurs on a button, <code>onClick<\/code> function of a component will be executed.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8UkFzUEhzakQ2bUE.png\"><img decoding=\"async\" class=\"aligncenter wp-image-5651\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8UkFzUEhzakQ2bUE.png\" alt=\"0B0b09VuqaAG8UkFzUEhzakQ2bUE\" width=\"715\" height=\"338\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8UkFzUEhzakQ2bUE.png 905w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/06\/0B0b09VuqaAG8UkFzUEhzakQ2bUE-300x142.png 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/a><\/p>\n<p>To sum up, in Angular 2:<\/p>\n<p>Property bindings are executed automatically,<br \/>\nEvent bindings allow propagation of DOM changes.<\/p>\n<p>Watch this video to better understand the data binding in Angular 2: <a href=\"https:\/\/angularu.com\/Video\/2015sf\/misko-hevery-talks-about-databinding-in-angular-2\" target=\"_blank\">https:\/\/angularu.com\/Video\/2015sf\/misko-hevery-talks-about-databinding-in-angular-2<\/a><\/p>\n<h2>Forms<\/h2>\n<p>Property and event bindings makes two two-way data binding possiblebut an additional effort is required in order to achieve it. Fortunately, Angular 2 will be shipped with Angular 2 Forms module. This module will be used for handling user input, by defining and building a control objects and mapping them onto the DOM. Control objects can then be used to read information from the form elements.<\/p>\n<p>Read more about Angular 2 Forms: <a href=\"http:\/\/angularjs.blogspot.com\/2015\/03\/forms-in-angular-2.html\" target=\"_blank\">http:\/\/angularjs.blogspot.com\/2015\/03\/forms-in-angular-2.html<\/a><\/p>\n<h2>Directive<\/h2>\n<p>A component is not the only UI building block in Angular 2. There are also directives which allow you to attach behavior to elements in the DOM.<\/p>\n<p>The difference between a component and a directive in Angular 2 is that a component is a directive with a view whereas a directive is a decorator with no view.<\/p>\n<p>A directive requires a single <code>@Directive<\/code> decorator and a directive class:<\/p>\n<pre class=\" brush:php\">import {Directive, ElementRef} from 'angular2\/angular2';\r\n\r\n@Directive({\r\n    selector: \"[highlight]\",\r\n    hostListeners: {\r\n        'mouseenter': 'onMouseEnter()',\r\n        'mouseleave': 'onMouseLeave()'\r\n    }\r\n})\r\nclass Highlight {\r\n\r\n    constructor(private element:ElementRef) {\r\n\r\n    }\r\n\r\n    onMouseEnter() {\r\n        this.outline('#f00 solid 1px');\r\n    }\r\n\r\n    onMouseLeave() {\r\n        this.outline();\r\n    }\r\n\r\n    private outline(outline:string = \"\") {\r\n        this.element.domElement.style.outline = outline;\r\n    }\r\n}<\/pre>\n<p>The above directive, when used on an element, adds an outline effect to the host element \u2013 the element it is used on. <code>ElementRef<\/code> is automatically provided by Angular 2 Dependency Injection module.<\/p>\n<p>Usage example:<\/p>\n<pre class=\" brush:php\">&lt;div highlight&gt;Lorem ipsum...&lt;\/div&gt;<\/pre>\n<h2>Dependency Injection<\/h2>\n<p>In Angular 2 there is a single way to inject dependencies into a directive or a component. In the below example a user-defined service is injected into a component. <code>MessageService<\/code> declares some business logic:<\/p>\n<pre class=\" brush:php\">\/\/ messageService.ts\r\nexport class MessageService {\r\n\r\n    private messages:Array&lt;string&gt; = [\r\n        \"Hello, Angular2\",\r\n        \"Angular2 is cool!\",\r\n        \"Damn it! Stop doing this!\"];\r\n\r\n    public getMessage() {\r\n        return this.messages[Math.floor(\r\n            Math.random() * this.messages.length)];\r\n    }\r\n}<\/pre>\n<p>The component is requesting framework to provide a required dependency via its constructor:<\/p>\n<pre class=\" brush:php\">import {Component, View, bootstrap} from 'angular2\/angular2';\r\nimport {MessageService} from 'messageService'\r\n\r\n@Component({\r\n    selector: 'hello-angular2'\r\n})\r\n@View({\r\n    template: '&lt;h1 (click)=\"onClick()\"&gt;{{message}}&lt;\/h1&gt;',\r\n})\r\nclass HelloAngular2Cmp {\r\n\r\n    private message:string;\r\n\r\n    constructor(private messageService:MessageService) {\r\n\r\n    }\r\n\r\n    onClick() {\r\n        this.message = this.messageService.getMessage();\r\n    }\r\n}<\/pre>\n<p>The <code>MessageService<\/code> is imported from an external module and later it must be made available to Angular 2. One way to make dependencies available is to register them globally with a <code>bootstrap()<\/code> function like the one below:<\/p>\n<pre class=\" brush:php\">bootstrap(HelloAngular2Cmp, [MessageService]);<\/pre>\n<p>Please note that framework services, directives or components, an iterable live list of components (<code>@Query<\/code>) and attributes (<code>@Attribute<\/code>) can be injected in the same, uniform way. The new DI module is designed the way it supports easy extending (<code>DependencyAnnotation<\/code>) so even custom dependency injection annotation can be created. In addition, Angular 2 supports injecting promises (<code>@InjectPromise<\/code>), lazy dependencies (<code>@InjectLazy<\/code>) or optional dependencies (<code>@Optional<\/code>).<\/p>\n<p>Read more about Angular 2 Dependency Injection in this great article: <a href=\"http:\/\/blog.thoughtram.io\/angular\/2015\/05\/18\/dependency-injection-in-angular-2.html\" target=\"_blank\">http:\/\/blog.thoughtram.io\/angular\/2015\/05\/18\/dependency-injection-in-angular-2.html<\/a><\/p>\n<h2>Summary<\/h2>\n<p>As you can see Angular 2 is much different from Angular 1.x. No DDO, no $scope, no angular.module, new change detection and binding, uniform template syntax, new dependency injection, new forms module, new router and much more.<\/p>\n<p>The new version of the framework should also be much simpler to learn thanks to easier and more concise concepts like component-based architecture. Moreover, Angular 2 should be significantly faster than its ancestor thanks to completely rewritten data binding and change detection.<\/p>\n<p>Is there a way to migrate from Angular 1.x? In my opinion it will not be easy. But there are some tips out there that may help in migration:<\/p>\n<ul>\n<li>Prefer one-way data-bindings to two-way data-bindings,<\/li>\n<li>Use ControllerAs syntax for easier migration to components,<\/li>\n<li>Do not update application state inside watch functions,<\/li>\n<li>Follow the newest releases (1.4, 1.5) and upgrade,<\/li>\n<li>Think of using New Router when available (<a href=\"https:\/\/angular.github.io\/router\/\" target=\"_blank\">https:\/\/angular.github.io\/router\/<\/a>),<\/li>\n<li>Think of using TypeScript in Angular 1.x applications.<\/li>\n<\/ul>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"http:\/\/angular.io\" target=\"_blank\">Official Angular 2 Website<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/angular\/angular\" target=\"_blank\">Angular 2 Source code<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/timjacobi\/angular2-education\" target=\"_blank\">Learning source on GitHub with tons of useful links<\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/blog.codeleak.pl\/2015\/06\/angular2hello-world.html\">ANGULAR2 HELLO, WORLD<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Rafal Borowiec at the <a href=\"http:\/\/blog.codeleak.pl\/\">Codeleak.pl<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically. Angular 2 looks like a completely different framework: no DDO, no $scope, no angular.module and completely rewritten binding and change detection (no ng-model). Although Angular 2 is still &hellip;<\/p>\n","protected":false},"author":92,"featured_media":909,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-5645","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Angular2]=&quot;{{&#039;Hello, World!&#039;}}&quot; - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Angular2]=&quot;{{&#039;Hello, World!&#039;}}&quot; - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-30T13:15:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rafal Borowiec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/kolorobot\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rafal Borowiec\" \/>\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:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\"},\"author\":{\"name\":\"Rafal Borowiec\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c007f4fc5d9c752a9ae61115f9d1effd\"},\"headline\":\"[Angular2]=&#8221;{{&#8216;Hello, World!&#8217;}}&#8221;\",\"datePublished\":\"2015-06-30T13:15:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\"},\"wordCount\":1060,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"articleSection\":[\"Angular.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\",\"name\":\"[Angular2]=\\\"{{'Hello, World!'}}\\\" - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"datePublished\":\"2015-06-30T13:15:11+00:00\",\"description\":\"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Angular.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"[Angular2]=&#8221;{{&#8216;Hello, World!&#8217;}}&#8221;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c007f4fc5d9c752a9ae61115f9d1effd\",\"name\":\"Rafal Borowiec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"caption\":\"Rafal Borowiec\"},\"description\":\"Rafal is an IT specialist with about 8 years of commercial experience, specializing in software testing and quality assurance, software development, project management and team leadership. He is currently holding a position of a Team Leader at Goyello where he is mainly responsible for building and managing teams of professional developers and testers. He is also responsible for maintaining relations with customers and acquiring new ones, mainly through consultancy. He believes in Agile project management and he is a big fan of technology, especially Java related (but not limited too). He likes sharing knowledge about software development and practices, through his blog (blog.codeleak.pl) and Twitter (@kolorobot) but also on internal and external events like conferences or workshops.\",\"sameAs\":[\"http:\/\/blog.codeleak.pl\/\",\"http:\/\/pl.linkedin.com\/in\/borowiec\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/kolorobot\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/rafal-borowiec\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Angular2]=\"{{'Hello, World!'}}\" - Web Code Geeks - 2026","description":"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.","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:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/","og_locale":"en_US","og_type":"article","og_title":"[Angular2]=\"{{'Hello, World!'}}\" - Web Code Geeks - 2026","og_description":"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-06-30T13:15:11+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Rafal Borowiec","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/kolorobot","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Rafal Borowiec","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/"},"author":{"name":"Rafal Borowiec","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c007f4fc5d9c752a9ae61115f9d1effd"},"headline":"[Angular2]=&#8221;{{&#8216;Hello, World!&#8217;}}&#8221;","datePublished":"2015-06-30T13:15:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/"},"wordCount":1060,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","articleSection":["Angular.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/","name":"[Angular2]=\"{{'Hello, World!'}}\" - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","datePublished":"2015-06-30T13:15:11+00:00","description":"As I mentioned in my recent blog post Angular 2 is a complete rewrite. Many concepts that are known from Angular 1.x are gone or changed dramatically.","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular2-hello-world\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Angular.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/"},{"@type":"ListItem","position":4,"name":"[Angular2]=&#8221;{{&#8216;Hello, World!&#8217;}}&#8221;"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c007f4fc5d9c752a9ae61115f9d1effd","name":"Rafal Borowiec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","caption":"Rafal Borowiec"},"description":"Rafal is an IT specialist with about 8 years of commercial experience, specializing in software testing and quality assurance, software development, project management and team leadership. He is currently holding a position of a Team Leader at Goyello where he is mainly responsible for building and managing teams of professional developers and testers. He is also responsible for maintaining relations with customers and acquiring new ones, mainly through consultancy. He believes in Agile project management and he is a big fan of technology, especially Java related (but not limited too). He likes sharing knowledge about software development and practices, through his blog (blog.codeleak.pl) and Twitter (@kolorobot) but also on internal and external events like conferences or workshops.","sameAs":["http:\/\/blog.codeleak.pl\/","http:\/\/pl.linkedin.com\/in\/borowiec\/","https:\/\/x.com\/https:\/\/twitter.com\/kolorobot"],"url":"https:\/\/www.webcodegeeks.com\/author\/rafal-borowiec\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/5645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/92"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=5645"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/5645\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/909"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=5645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=5645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=5645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}