{"id":33435,"date":"2016-04-06T17:33:40","date_gmt":"2016-04-06T12:03:40","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=33435"},"modified":"2017-09-12T12:44:38","modified_gmt":"2017-09-12T07:14:38","slug":"comparison-between-angular-and-polymer","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/comparison-between-angular-and-polymer\/","title":{"rendered":"Comparison between Angular and Polymer"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>Angular :- \u00a0<\/b>Angular is a robust application level js framework based on MVC pattern, facilitate you to extend HTML&#8217;s syntax to express application&#8217;s components clearly. Angular&#8217;s bi-directional data binding and dependency injection reduce code complexity and development time.<\/p>\n<p style=\"text-align: justify;\"><b>Polymer :-\u00a0<\/b>Polymer is a lightweight js library used to build custom reusable HTML elements(components). It uses standard web component API to create rich, configurable and standard web components by encapsulating js, css, and HTML.<\/p>\n<p style=\"text-align: justify;\"><b>Difference b\/w Angular and Polymer &#8211;\u00a0<\/b>Angular and Polymer both are js framework\/library, developed\u00a0by \u2013 Google Inc. <a title=\"What is Angular\" href=\"http:\/\/www.tothenew.com\/blog\/building-intuitive-frontend-interfaces-with-angularjs\/\">Angular is an application level framework<\/a> and Polymer is the library to create web components.<\/p>\n<p style=\"text-align: justify;\"><a title=\"Angular development\" href=\"http:\/\/www.tothenew.com\/front-end-angularjs-development\">Angular development<\/a> is mainly used to build CRUD apps, although Polymer Web component too could be arranged to develop the application.<\/p>\n<p style=\"text-align: justify;\">Angular directive and Polymer component show some similarity but approach to create custom HTML elements differs. Polymer uses standard web component API\u00a0to create a rich custom tag that encapsulates js, CSS, and HTML altogether. While Angular compose only HTML and js to create reusable directive without the use of web component API.<\/p>\n<p style=\"text-align: justify;\">Web component API includes these four elements\u00a0&#8211;<\/p>\n<ol>\n<li style=\"text-align: justify;\">Custom elements<\/li>\n<li style=\"text-align: justify;\">HTML Templates<\/li>\n<li style=\"text-align: justify;\">\u00a0Shadow DOM<\/li>\n<li style=\"text-align: justify;\">\u00a0HTML Imports<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">Polymer uses these elements\u00a0to define a custom element. But web component API\u00a0is supported only by modern web browsers, so Polymer component might create some issue with older browsers.<\/p>\n<p style=\"text-align: justify;\">Polymer core library provides some standard web components, that could be used in application with ease, hence development time could be reduced by using existing web components. But when you talk about stability, Angular wins. Angular is a robust framework with high level APIs for services, routines, filters, animation etc. While Polymer is still in alpha phase.<\/p>\n<p style=\"text-align: justify;\">Both Angular and Polymer support templating and bi-directional data binding, while Polymer facilitate an additional functionality Shadow DOM, enables css encapsulation for components.<\/p>\n<p style=\"text-align: justify;\">And one more thing, Polymer components are easier to develop as compared to Angular directive.<\/p>\n<p style=\"text-align: justify;\"><b>Example &#8211;<\/b><\/p>\n<p style=\"text-align: justify;\"><b><b>Angular directive &#8211;<\/b><\/b><\/p>\n<pre><code>angular.module('mySimpleDirective', []).controller('Controller', ['$scope', function($scope) {\r\n \r\n $scope.user = {\r\n  name: 'abc',\r\n  address: 'xyz'\r\n };\r\n\r\n}]).directive('user', function() {\r\n\r\n return {\r\n  template: 'Name: {{user.name}} Address: {{user.address}}'\r\n };\r\n\r\n});<\/code><\/pre>\n<p style=\"text-align: justify;\"><b><b>Polymer component &#8211;<\/b><\/b><\/p>\n<pre><code>&lt;!-- Imports polymer --&gt;\r\n&lt;link rel=\"import\" href=\"..\/polymer\/polymer.html\"&gt;\r\n&lt;!-- Defines element markup --&gt;\r\n&lt;dom-module id=\"hello-world\"&gt;\r\n    &lt;template&gt;\r\n        &lt;p&gt;&lt;strong&gt;{{welcomeMessage}}&lt;\/strong&gt;&lt;\/p&gt;\r\n    &lt;\/template&gt;\r\n&lt;\/dom-module&gt;\r\n&lt;!-- Registers custom element --&gt;\r\n&lt;script&gt; Polymer({\r\n    is: 'hello-world',\r\n\r\n    properties: {\r\n\r\n        welcomeMessage: {\r\n\r\n            type: String,\r\n\r\n            value: 'Hello World'\r\n\r\n        }\r\n\r\n    } });\r\n&lt;\/script&gt;\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><b>Personal experience\u00a0&#8211; <\/b><\/p>\n<p style=\"text-align: justify;\">If you want to develop a lightweight web app using some existing Polymer core components and want to attach some of\u00a0your own custom tags, Polymer might be the right choice. While for a complex CRUD app, you should go with Angular.<\/p>\n<p style=\"text-align: justify;\">The combination of both also could be used according to project requirements and personal choice of technology. Hope this will help you to choose\u00a0the right option for your development stack.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Angular :- \u00a0Angular is a robust application level js framework based on MVC pattern, facilitate you to extend HTML&#8217;s syntax to express application&#8217;s components clearly. Angular&#8217;s bi-directional data binding and dependency injection reduce code complexity and development time. Polymer :-\u00a0Polymer is a lightweight js library used to build custom reusable HTML elements(components). It uses standard [&hellip;]<\/p>\n","protected":false},"author":909,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2},"categories":[1439,3429,1],"tags":[3955,3203,3202,955,4697,998,4842,55,3178,1173],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/33435"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/909"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=33435"}],"version-history":[{"count":1,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/33435\/revisions"}],"predecessor-version":[{"id":51798,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/33435\/revisions\/51798"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=33435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=33435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=33435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}