<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Enes Yilmaz on Medium]]></title>
        <description><![CDATA[Stories by Enes Yilmaz on Medium]]></description>
        <link>https://medium.com/@enessyilmaz?source=rss-6e37bee5e22a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9IKf83h_ZgGgUOVeRvSb9g.jpeg</url>
            <title>Stories by Enes Yilmaz on Medium</title>
            <link>https://medium.com/@enessyilmaz?source=rss-6e37bee5e22a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:31:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enessyilmaz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Top 8 Angular Graphics Libraries]]></title>
            <link>https://enessyilmaz.medium.com/en-i%CC%87yi-8-angular-grafik-kitapl%C4%B1klar%C4%B1-52dc2af2c0ff?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/52dc2af2c0ff</guid>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[ng2-charts]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[libraries]]></category>
            <category><![CDATA[bar-chart]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Wed, 15 Mar 2023 20:08:55 GMT</pubDate>
            <atom:updated>2023-03-24T20:31:50.075Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hXgdXfzogD9TAu6-UoOp2w.png" /></figure><p>Data analytics is a crucial part of any business application today. This helps businesses make important decisions. It is important to represent large amounts of data in an easy to understand and interactive way.<br>Charts are beautiful, easy to understand and very useful for interactive data representation and visualization.<br>There are different open source and paid graph libraries in javascript (with angular wrapper) for beautiful data representation.<br>In this post, we will see the best angular chart libraries for beautiful and interactive data representation.<br>First, we will see open source angular graphics libraries, then we will look at other paid graphics libraries for angular.</p><p><strong>Best Open Source Angular Graphics Libraries</strong></p><ol><li><a href="https://swimlane.github.io/ngx-charts/#/ngx-charts/bar-horizontal">ngx-charts</a></li><li><a href="https://xieziyu.github.io/ngx-echarts/#/basic/basic-usage">ngx-echarts</a></li><li><a href="https://valor-software.com/ng2-charts/#GeneralInfo">ng2-charts</a></li><li><a href="https://plotly.com/javascript/">angular-plotly.js</a></li><li><a href="https://primeng.org/chart">PrimeNG Chart</a></li><li><strong>Ngx-charts</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QwVL0vejLHdB9CcRp2ynYw.png" /></figure><p>Ngx-charts is a declarative charting framework for angular2+.<br>It uses Angular to render and animate SVG elements with all the binding and speed goodness, and it has excellent math functions, scales, axis and shape generators, etc. uses d3 for<br>By outsourcing all the processing to Angular, AoT, Universal, etc. offered by the Angular platform. opens up endless possibilities.<br>Ngx-charts allows us to customize styles using CSS. We can also create custom charts using ngx-charts components.<br>It has an active developer community.</p><p><strong>Installation</strong></p><p>You can install ngx-charts charts using NPM as follows.</p><pre>npm install @swimlane/ngx-charts --save</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0Bit1mmAnubUwmK1pFkdw.png" /></figure><p><strong>Chart Types</strong></p><ul><li>Horizontal &amp; Vertical Bar Charts (Standard, Grouped, Stacked, Normalized)</li><li>Line</li><li>Area (Standard, Stacked, Normalized)</li><li>Pie (Explodable, Grid, Custom legends)</li><li>Bubble</li><li>Doughnut</li><li>Gauge (Linear &amp; Radial)</li><li>Heatmap</li><li>Treemap</li><li>Number Cards</li></ul><p><strong>Customization (Özelleştirme)</strong></p><ul><li>Autoscaling</li><li>Timeline Filtering</li><li>Line Interpolation</li><li>Configurable Axis Labels</li><li>Legends (Labels &amp; Gradient)</li><li>Advanced Label Positioning</li><li>Real-time data support</li><li>Advanced Tooltips</li><li>Data point Event Handlers</li><li>Theming</li><li>Works with ngUpgrade</li></ul><p><strong>2. Ngx-echarts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZypgur-90Ci7Z1IHc6GJQ.png" /></figure><p>Ngx-ecarts is an angular (ver &gt;= 2.x) directive for ECharts (ver &gt;= 3.x)<br>eCharts is an open-source, web-based, cross-platform framework that supports rapid rendering of interactive visualizations.<br>It has 39.6k stars and 13.2k forks on Github, ECharts is considered the world’s leading visualization development tool and ranks third in the GitHub visualization tab.<br>It can run fluently on PC and mobile devices. IE8/9/10/11, Chrome, Firefox, Safari etc. Compatible with most modern Web Browsers such as eCharts relies on ZRender, a graphics rendering engine to create intuitive, interactive and highly customizable graphics.</p><p><strong>Installation</strong></p><p>You can install ngx-ecarts using NPM or yarn as follows.</p><pre># if you use npm<br>npm install echarts -S<br>npm install ngx-echarts -S<br><br># or if you use yarn<br>yarn add echarts<br>yarn add ngx-echarts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IH7APf-0oV_ppZRt_JEHaQ.png" /></figure><p><strong>Chart Types</strong></p><ul><li>Line series</li><li>bar series</li><li>scatter series</li><li>pie charts</li><li>candle-stick series</li><li>boxplot series for statistics</li><li>map series</li><li>heatmap series</li><li>line series for directional information</li><li>graph series for relationships</li><li>treemap series</li><li>sunburst series</li><li>parallel series for multi-dimensional data</li><li>funnel series</li><li>gauge series</li></ul><p><strong>Customization (Özelleştirme)</strong></p><ul><li>Loading Handling</li><li>Event Handling</li><li>Real-time data update</li><li>Initial Options</li><li>Auto Resize</li><li>Theming</li><li>Connect Charts</li><li>Draggable Charts</li><li>3D Charts</li></ul><p>See the ECharts Documentation for more customization.</p><p><strong>3. Ng2-Charts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-b-IgYZMq0iNMP6ZXqsmw.png" /></figure><p>ng2-charts is an Angular2 directive for Chart.js<br>Chart.js is a popular open source javascript chart library.<br>Chart.js uses HTML5 canvas which provides great rendering performance in all modern browsers (IE11+).<br>Angular provides schematics for easy integration in the application.</p><p><strong>Installation</strong></p><p>You can install ng2 charts using NPM as follows.</p><pre># if you use npm<br>npm install --save ng2-charts<br>npm install --save chart.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxVEWm8HCAe97MBNO-mvSQ.png" /></figure><p><strong>Chart Types</strong></p><ul><li>line chart</li><li>bar chart</li><li>radar chart</li><li>pie chart</li><li>polar area chart</li><li>donut chart</li><li>bubble chart</li><li>scatter chart</li></ul><p><strong>Customization (Özelleştirme)</strong></p><ul><li>Legends</li><li>Labels</li><li>Colors</li><li>Tooltip</li><li>Theming</li><li>Combine Charts</li><li>Options (as from <a href="https://www.chartjs.org/docs/latest/">chart.js documentation</a>)</li></ul><p><strong>4. Angular Plotly.js</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lulQU6QL8TraFKWuc15Dng.png" /></figure><p>Angular-plotly.js is a plotly.js angular component from plotly.<br>It supports Angular 9.x, if you want to use it with Angular 8.x, please use angular-plotly.js@1.x version.<br>Built on d3.js and stack.gl, plotly.js is a high-level, declarative graphics library. plotly.js comes with over 40 chart types, including scientific charts, 3D charts, statistical charts, SVG maps, financial charts, and more.<br>Plotly.js has 11.2k stars and 1.3k forks on github.</p><p><strong>Installation</strong></p><p>You can install plotly.js using NPM or yarn as follows.</p><pre># if you use npm and yarn<br>npm install plotly.js-dist<br>yarn install plotly.js-dist</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*qWEDBBvm5SKFUcYSBXKrHQ.png" /></figure><p><strong>Chart Types</strong></p><p>Basic Charts:</p><ul><li>Scatter Plots</li><li>Bar Charts</li><li>Line Charts</li><li>Pie Charts</li><li>Bubble Charts</li><li>Dot Plots</li><li>Filled Area Plot</li><li>Horizontal bar charts</li><li>Sunburst Charts</li><li>Sankey Diagram</li><li>Point Cloud</li><li>Multi Chart Types</li></ul><p>Statistical Charts:</p><ul><li>Error Bars</li><li>Box Plots</li><li>Histograms</li><li>2D density plots</li><li>parallel categories diagram</li></ul><p>Financial Charts:</p><ul><li>Waterfall Charts</li><li>Indicators</li><li>CandleStick charts</li><li>Funnel and Funnel Area Charts</li></ul><p>Maps:</p><ul><li>Mapbox map layers</li><li>Mapbox density heatmap</li><li>Choropleth mapbox</li><li>lines on maps etc.</li></ul><p>3D Charts:</p><ul><li>3D Scatter Plots</li><li>Ribbon Plots</li><li>3D Surface plots</li><li>3D mesh plots etc</li></ul><p><strong>Customization (Özelleştirme)</strong></p><ul><li>Download as SVG / PNG</li><li>Data export</li><li>Events Handling</li><li>Auto Resize</li><li>Scroll</li><li>Zoom</li><li>Filter</li><li>Animation</li><li>Group by</li></ul><p>See Plotly.js documentation for more customization details.</p><p><strong>5. PrimeNG Charts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cr7Z5-W1ZnfCWSSYgrJlVQ.png" /></figure><p>PrimeNg chart components are based on Charts.js 2.7.x, an open source HTML5 based chart library.<br>PrimeNG is a collection of rich UI components for Angular. All widgets are open source and free to use under the MIT License.</p><p><strong>Installation</strong></p><p>You can install PrimeNG Charts using NPM as follows.</p><pre># if you use npm <br>npm install primeng --save<br>npm install primeicons --save<br>npm install chart.js --save</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CFd7eRdDVebREgguonBbQ.png" /></figure><p><strong>Chart Types</strong></p><ul><li>pie chart</li><li>doughnut chart</li><li>line(line or horizontal bar) chart</li><li>bar chart</li><li>radar chart</li><li>polar area chart</li></ul><p><strong>Customization (Özelleştirme)</strong></p><ul><li>Responsive</li><li>Event Handling</li><li>Labels</li><li>Legends</li><li>Tooltip</li><li>Width and Height</li><li>Options (as per <a href="https://www.chartjs.org/docs/latest/">chart.js documentation</a>)</li></ul><h4>Other Angular Chart Libraries</h4><p><a href="https://developers-dot-devsite-v2-prod.appspot.com/chart/interactive/docs/gallery">6. Angular Google Charts</a></p><p><a href="https://www.highcharts.com/demo">7. Highcharts Angular</a></p><p><a href="https://www.fusioncharts.com/fusionmaps/europe-countries-turkey">8. Angular Fusion Charts</a></p><p><strong>6. Angular Google Charts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzvfqS9c-HVDkpwd5oG_Hw.png" /></figure><p>angular-google-charts is a wrapper of the Google Charts library written for Angular 6 &amp; 7.<br>Google chart tools are powerful, simple to use, and free.<br>Note: Google Charts is free but not open source. Google’s licensing does not allow you to host JS files on your server. So, if you are an organization and have some sensitive data, Google Charts may not be the best option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgDegL8fh24r-PhGrFxIhA.png" /></figure><p><strong>Installation</strong></p><p>You can install angular-google-charts using NPM as follows.</p><pre># if you use npm <br>npm i angular-google-charts</pre><p><strong>7. Highcharts Angular</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qN3BcUxZ3Sd-Zk40hJMUA.png" /></figure><p>Highcharts Angular is an official Highcharts wrapper for angular.<br>Highcharts is a modern SVG-based, multiplatform graphics library. It has a rich collection of graphics.<br>Highcharts is free for non-commercial use and paid for commercial use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qLyfogWFQBd6YLS6TNJWw.png" /></figure><p><strong>Installation</strong></p><p>You can install Highcharts Angular using NPM as follows.</p><pre># if you use npm <br>npm i highcharts-angular</pre><p><strong>8. Angular Fusion Charts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cez1hFPOpV4qfC3BXkctBQ.png" /></figure><p>angular-fusioncharts is a simple and lightweight official Angular component for the FusionCharts JavaScript chart library. angular-fusioncharts lets you seamlessly add JavaScript charts to your Angular app.<br>FusionCharts is a javascript chart library and includes charts such as pie, column, area, line, radar and more than 150 other charts for web application.<br>Fusion charts provides a paid license for commercial use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8H2qymCfEX02FRUEk-VOlQ.png" /></figure><p><strong>Installation</strong></p><p>You can install angular-fusion charts using NPM as follows.</p><pre># if you use npm <br>npm i angular-fusioncharts</pre><p><strong>Conclusion</strong></p><p>In this article, we learned about popular angular charts libraries and how to download them. Thank you. See you in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52dc2af2c0ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Most Popular Angular Libraries]]></title>
            <link>https://enessyilmaz.medium.com/10-most-popular-angular-libraries-dadde81aee2f?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dadde81aee2f</guid>
            <category><![CDATA[angular-material]]></category>
            <category><![CDATA[ngx-bootstrap]]></category>
            <category><![CDATA[primeng]]></category>
            <category><![CDATA[popular]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 18:54:03 GMT</pubDate>
            <atom:updated>2023-02-04T18:54:03.967Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_Z6Ofm0Bi1UZytYOf1KnA.png" /></figure><p><strong>1.Angular Material</strong></p><p>Angular Material is a tool developed by Google and is a library of UI/UX components suitable for use with the Angular framework. Angular Material offers functional UI components, styling and animations to create a professional and modern interface. Components include functions such as form elements, navigation elements, data tables and graphs. Angular Material helps you create a high quality and mobile friendly interface for Angular apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Z_obNDwhL12rKnUWmnU7HA.jpeg" /></figure><p>Attracts users and accesses items or components available in our app. It also helps us design our apps with unique styles and shapes.</p><p>These components make the app or website more consistent and make the design responsive. It combines the classic principles of successful design with innovation and technology.</p><p>Google developed Angular Material in 2014. Back then, it was tagged as AngularJS to make applications more attractive and faster performance. Google rewrote the code from scratch and removed JS, then named it Angular Material in September 2016. UI/UX components are known as Angular Materials.</p><p><strong>Installation</strong></p><p>You can install Angular Material using NPM or Yarn as follows.</p><pre>// with npm<br>npm i @angular/material<br><br>// with yarn<br>yarn add @angular/material</pre><p><strong>2.NGX Bootstrap</strong></p><p>NGX Bootstrap is a UI component library for the Angular framework. It adapts Bootstrap 4 style to Angular applications and provides powerful and flexible UI components to Angular applications. NGX Bootstrap includes popular UI components such as modal windows, carousel, dropdown menus, tabs, alert and toast notifications. It is frequently preferred by Angular developers because it is easy to use and configurable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*ojsgwT4lusaCzHFgFgCiWA.png" /></figure><ul><li>All components are modular by design. Custom templates, Styles can be applied easily.</li><li>All components are expandable and adaptable and work with the same ease and performance on desktop and mobile devices.</li><li>All components use the latest style guides and guidelines for code maintenance and readability.</li><li>All components are fully unit tested and support the latest angular versions.</li><li>All components are richly documented and well written.</li><li>All components have multiple working demos to showcase multiple types of functionality.</li><li>ngx bootstrap is an open source project. Backed by the MIT License.</li></ul><p><strong>Installation</strong></p><p>You can install NGX Bootstrap using NPM or Yarn as follows.</p><pre>// with npm<br>npm i ngx-bootstrap<br><br>// with yarn<br>yarn add ngx-bootstrap</pre><p><strong>3.NG Bootstrap</strong></p><p>ng-bootstrap is an open source repository that provides several native Angular widgets built using Bootstrap 4 CSS. As you know, Bootstrap is one of the most popular CSS frameworks used to create stylish and modern applications with HTML, CSS and JavaScript libraries. To use Bootstrap frameworks in Angular app we had to use bootstrap CSS as well as JavaScript files before, but “ng-bootstrap” gives us the best approach to use it without any JS files in our Angular apps.<br>“ng-bootstrap” provides a module that can be loaded in our Angular applications that provides us native Angular components and widgets that we can use as we use other Angular supplied components or our custom components.<br>Since “ng-bootstrap” is a module that encapsulates all Bootstrap functions, there is no need to use any other 3rd party libraries in our Angular app. As a result, there is no dependency on jQuery or even Bootstrap’s JavaScript library.<br>Bootstrap 4.0.0 (CSS file only, Bootstrap.js and Bootstrap.min.js not required) Both Angular 4+ and Bootstrap 4.0.0 support all browsers with the same browser intersection supported by CSS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*0pSlLtneaOrGttICUtmahw.jpeg" /></figure><ul><li>A variety of widgets to choose from, including all Bootstrap widgets.</li><li>Developers can use Bootstrap components like modals, carousels, progress bars, etc.</li><li>Having a basic understanding of Angular is enough to use NG Bootstrap.</li><li>Components are lightweight and responsive.</li><li>The library does not depend on other dependencies.</li><li>All components are tested with 100% coverage.</li><li>Large community for support.</li></ul><p><strong>Installation</strong></p><p>You can install NG Bootstrap using NPM or Yarn as follows.</p><pre>// with npm<br>npm i @ng-bootstrap/ng-bootstrap <br><br>// with yarn<br>yarn add @ng-bootstrap/ng-bootstrap</pre><p><strong>4.Onsen UI for Angular</strong></p><p>Onsen UI for Angular is a UI component library for the Angular framework. It is optimized for mobile applications and designed using HTML5 and CSS technologies. Onsen UI for Angular provides mobile-friendly and powerful UI components to Angular apps, but is also available for desktop browsers. Components include popular UI components such as navigation elements, form elements, tabs, modal windows, and toast notifications. Onsen UI for Angular is an option that has a simple and easy API and can be used with Angular.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2n3GNP6xIrtJ2yNhqVJRpg.jpeg" /></figure><p>Onsen UI is framework independent, meaning developers can create apps with or without any JavaScript framework. Onsen UI also includes extra connector packages to make its API easy to use with popular frameworks such as:</p><ul><li>React</li><li>Vue</li><li>AngularJS 1</li><li>Angular 2+</li></ul><p>Onsen UI is performance optimized for mobile devices so it is suitable for mobile web application development.</p><p><strong>Installation</strong></p><p>You can easily install Onsen UI using NPM as follows.</p><pre>// with npm<br>npm install onsenui ngx-onsenui --save</pre><p><strong>5.PrimeNg</strong></p><p>PrimeNG is a UI component library for the Angular framework. PrimeNG provides professional and multi-functional UI components to Angular applications. Components include data table, chart, slider, dropdown, tab, lightbox, tree and many other functional UI components. PrimeNG was created to improve the performance and user experience of Angular applications and is easily configurable. It can also be used with Angular and offers theme support as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*XGuIor9WbVeU62RyJ8jr4A.png" /></figure><ul><li>More than 80 different components.</li><li>A theme designer lets you create your own themes.</li><li>Anyone can easily get started with professionally designed, customizable templates provided by PrimeNG.</li><li>200+ icons.</li><li>280+ UI blocks.</li><li>It is constantly being updated. If any problems arise, they can be resolved quickly.</li></ul><p><strong>Installation</strong></p><p>You can install PrimeNG using NPM or Yarn as follows.</p><pre>// with npm<br>npm i primeng<br><br>// with yarn<br>yarn add primeng</pre><p><strong>6.NG Lightning</strong></p><p>NG Lightning is a popular Angular component library for Salesforce development. This library relies on input features to provide better performance to end users. It is built on a native Angular component alongside a lightning design system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLMravTd8rmLPpyPFT9DCA.jpeg" /></figure><ul><li>It is focused on improved performance and greater development flexibility.</li><li>Expert in Angular and Salesforce development.</li><li>Written in TypeScript.</li></ul><p><strong>Installation</strong></p><p>You can install NG Lightning using NPM as follows.</p><pre>npm install --save ng-lightning</pre><p><strong>7. Syncfusion Angular UI</strong></p><p>Syncfusion Angular UI (Essential JS 2) is a collection of true Angular Components based on modern TypeScript. It has Ahead Of Time (AOT) compilation and Tree-Shaking support. All components have been developed from the ground up to be lightweight, responsive, modular and touch friendly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*654Cb6S2_ckROfe3jDgaaQ.png" /></figure><ul><li>To facilitate selective referencing, all components are designed as modules.</li><li>The components are touch-friendly and adaptable to multiple devices, resulting in a great user experience.</li><li>Components can be used by a global audience in various languages and cultures.</li><li>Lightweight.</li></ul><p><strong>Installation</strong></p><p>You can install the required packages via NPM.</p><pre>npm i @syncfusion/ej2-angular-base</pre><p><strong>8. Clarity</strong></p><p>Clarity Design System is an open source project that brings together UX guidelines, HTML/CSS framework, and Angular components that work together to create extraordinary experiences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*V7VBt2kFfoRXPHkPDBijeQ.png" /></figure><ul><li>Scalable and customizable components.</li><li>It can be used in any web application, regardless of the JavaScript framework.</li><li>It offers a set of well-designed and implemented data-bound components.</li></ul><p><strong>Installation</strong></p><p>You can install Clarity using NPM as follows.</p><pre>// with npm<br>npm i @clr/angular</pre><p><strong>9. Vaadin UI components</strong></p><p>Vaadin is a Java framework for building web applications that offers a wide range of UI components for building responsive and user-friendly interfaces. Some of the most commonly used Vaadin UI components include:</p><ul><li>TextField: for entering and displaying text</li><li>Button: for triggering actions</li><li>ComboBox: for selecting from a drop-down list of options</li><li>Grid: for displaying and manipulating tabular data</li><li>TreeGrid: for displaying hierarchical data</li><li>Chart: for creating interactive charts and graphs</li><li>TabSheet: for organizing content into tabs</li><li>SplitPanel: for dividing the UI into multiple resizable areas</li></ul><p>These components are highly customizable and can be styled with CSS to match the look and feel of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*TnXU2yYctF0yFPBk2mml-A.png" /></figure><ul><li>Responsive layouts.</li><li>A good base for your own design system.</li><li>Manually tested with common assistive technologies.</li><li>It handles server-client communication and routing quickly and securely.</li><li>Keyboard navigation and screen reader support are provided.</li></ul><p><strong>Installation</strong></p><p>You can install Vaadin using NPM as follows.</p><pre>// with npm<br>npm i @vaadin/vaadin-grid</pre><p><strong>10. Nebular</strong></p><p>Nebular is a UI Kit called by Akveo. It runs on the Angular framework and offers a set of ready-made components, themes, and tools to create user outputs. Nebular helps you create a modern and impressive result for current web applications. Also, Nebular, along with Angular, is easy to configure and easy to learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*QSpVNUMHnPtLt1HSArHSCA.jpeg" /></figure><ul><li>Authentication layer.</li><li>Excellent community support.</li><li>Components have configurable styles.</li><li>Implementation based on the Eva design system.</li></ul><p><strong>Installation</strong></p><p>You can install Nebular using NPM as follows.</p><pre>//with npm<br>npm i node-teradata</pre><p><strong>Conclusion</strong><br>In this article, we learned about popular angular libraries and how to download them. Thank you. See you in the next article.</p><p><strong>Author’s Opinion</strong></p><p>While preparing this article, I had the experience of using many of these libraries. Of these libraries, the best for me was the primeNG library. Other libraries are fine and successful as well, but my personal opinion is that primeNG library has a better and more organized source so it has attracted a bit more interest in this library. Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dadde81aee2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firebase]]></title>
            <link>https://enessyilmaz.medium.com/firebase-3ffb73f8346c?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ffb73f8346c</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firestore]]></category>
            <category><![CDATA[realtime]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sat, 21 Jan 2023 11:42:16 GMT</pubDate>
            <atom:updated>2023-01-21T11:42:16.374Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipwpqQrHz0Lkd_5setXQCQ.png" /></figure><ol><li><strong>What is firebase</strong></li></ol><p>Firebase was launched in April 2012 and acquired by Google in 2014 to provide the solution for backend developers. The feature combination in Firebase accelerates the cloud database integration in both web and mobile app. Firebase is a BaaS (Backend as a Service) , which reduces configuration and setting up logically without time consumption. In summer of 2016, Google released Firebase officially for the goals of earning income for developers, building a successful application and promoting the growth of the business. Firebase can be called an enhancement or upgrade for APIs, which allows extended functions such as messaging, and service authentication. Consequently, this minimizes the cost and consumed time to build these services. Firebase provides new technology for business to advance via linking or referrals. Then, the system is connected by anallysing the platform and is easy to integrate into the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kp0ck2-lj7oG6RVe7ZrBFg.png" /><figcaption>figure 1.1</figcaption></figure><p>It is not complex to create a Firebase application from scratch. As in figure 1.1, there are three features can be applied to the application: develop, grow, and earn. .Developers are not required to use all three pillars; they are chosen depending on different purposes. Some technologies are at no cost such as Cloud Messaging, Crash Reporting, Remote config or Dynamic Links.</p><p><strong>2. Firebase Authentication</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hw7lbWGP3Zbhn4t35zWk4Q.png" /><figcaption>figure 2.1</figcaption></figure><p>At present, many web services use authentication to identify users and secure the data by controlling access to their content. For instance, Google asks for account and password to log in some applications.<br>The authentication is more complicated due to a third-party authentication — APIs.Hence, it is a goal of the Firebase team to complete the authentication to support developers by supplying with the convenient API which lets users log in or sign in from federated providers. It cooperates also with the real-time database to control the access, as in figure 2. <br>The common federated providers are Google, GitHub, Facebook and Twitter. If developers manipulate Firebase, it is not necessary to repeat the sign-in process, because it is already integrated with the authentication system of these providers. If the user has an existing account it will instantly connect to the authentication system. Firebase supports standard functions such as forgotten password, and users’ verification via Firebase console. Users can anonymously sign in with temporary account and then the federated provider-base account is linked to that user. It also assists Smart Lock, which can automatically remember and sign-in by using the credentials. The email address is an essential credential to sign in, which then is passed to Firebase authentication SDK. Firebase back end server will verify these authentications, then reply to the client. User’s information can be determined when the user has the access to Firebase product or to control or verify their identity.</p><p>Firebase Auth is the least time-consuming option to integrate into programming. The actual project that supports Firebase authentication consumes longer time to write code than FirebaseUI Auth. It is an online library which allows clients to customize the common Firebase scenarios to provide the implementation for user authentication, which consists of user interface screens. FirebaseUI Auth covers many practices to authenticate on web, and mobile phone and is easy to handle. There are three main steps to integrate user authentication into apps on FirebaseUI Auth: Set up Sign-in methods, customize the sign-in UI, and use FirebaseUI to perform the sign-in flow. Firebase Authentication SDK takes more time than the previous one. Also, it provides the verification for authentication process over full controlling the outlook. Eventually, this option maintains a complete version of authentication including many steps to identify the user’s account. It is used to provide several tasks from signing in and out, logging in automatically to update the new user’s data to the app. Firebase Authentication SDK moreover federates identity provider integration and anonymous authentication. To approach Firebase Auth, Firebase Authentication SDK is applied primarily. There are some steps that should be considered: Set up Sign-in method, implement UI flows for your sign-in methods and pass the user’s credentials to the Firebase Authentication SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVIxtX0xaphlcslA-iLoEA.png" /><figcaption>figure 2.2</figcaption></figure><p>To take advantage of the benefits that Firebase provides, we first need to activate it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnJzUM0V7YDgO2MxhYdF0Q.png" /><figcaption>figure 2.3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SH0Et-rwxVWsj4MGHZD8kQ.png" /><figcaption>figure 2.4</figcaption></figure><p><strong>3. The Real-time Database</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVhbQ0eYLvAw93fOwfNHmg.png" /><figcaption>figure 3.1</figcaption></figure><p>The classic real-time database demonstrates the database system that overcomes the real-time restriction to consolidate a reliable database system. This is the key product of Firebase since it is a simple feature utilizing API. It syncs new information as JSON across all devices, in which real-time database collaborates the web and mobile version in the same device and shares with another device in milliseconds. Additionally, this product optimizes the offline service to save and store user information in the local cache and uses database SDKs so when the user is online, the data is synced automatically. The Realtime Firebase defines data structure and it is secured upon the Firebase Database Security Rules specifying people who can access particular information. With a few codes by clients, it describes who can see specific information. It is not necessary to exist operation or maintenance server because the cloud service hosts a real-time database (NoSQL — based database). Like other products, the Real-time database is available for Android, IOS, Web, C++, Unity Platform and JavaScript. Real-time Database can scale up to 100 000 concurrent connections and 1 000/second for each database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzpLo7eYeaaPoOuc7nY1hw.png" /><figcaption>figure 3.2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6v0scQtpincAqtoHOWNsrg.png" /><figcaption>figure 3.3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-WdrSJPI_zMoFHpP2xKBA.png" /><figcaption>figure 3.4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P15RWDWEILz2ORbe5Njigw.png" /><figcaption>figure 3.5</figcaption></figure><p>The data set is changed and upgraded due to the dissimilar database, and integration real-time database with Cocoa Pods, or Gradle to promote the access time with clients. This implementation also provides the written ability while offline but still keeps the security for clients. These four steps are the basic paths to create a Firebase Real-time Database: Integrate the Firebase Realtime Database SDKs, create Realtime Database References, set Data and Listen for Changes, enable Offline Persistence and secure data.</p><p><strong>4. Cloud Storage for Firebase</strong></p><p>Videos, photos and documents are stored online through Firebase Cloud Storage service that is backed up on Google Cloud Storage. A simple API is applied to build and manage an infrastructure to deal with large files. Hence, documents are shared with particular users with the Realtime Database Rule. It means this storage is cached since it is integrated with Firebase Authentication. Through Firebase SDKs, it is effortless to upload and share files on mobile devices that are accessible for both Google Cloud and Firebase. Moreover, it is not necessary to transfer the document to another provider due to the automatic scale on Cloud Storage. Firebase declarative security is available according to file types, filename or size. Firebase SDKs applies robust operation even when the network is disqualified, if a video is not successfully uploaded, when the internet connection is qualified, it will continue to transmit that video depending on where it stopped.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1FH95KE4he6d1iZOP79GQ.png" /><figcaption>figure 4.1</figcaption></figure><p>To comprehend this task, Firebase SDKs platform is built to interact with Firebase Cloud service. Admin SDK allows to read, programmatically send, access and generate Firebase Auth communicating with Firebase from the privileged environment. The following steps indicate how the Cloud Storage functions: integrate the Firebase SDKs for Cloud Storage, create a reference, upload or download and secure your Files.</p><p><strong>5. Cloud Firestore</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zrAlHh6DX_DUCGNDpd-CQQ.png" /></figure><p>Cloud Firestore is a service provided by Firebase exclusively for client applications and deeply integrated with other firebase products, including Google’s cloud functions serverless platform.</p><p>Cloud Firestore is a fully managed NoSQL database hosted in a serverless cloud made available by Google. It allows us to create a database in minutes. We don’t have to worry about server management and scalability and we can also build high performance service using Firestore.</p><p>Cloud Firestore is the successor to the firebase real-time database with greater flexibility and scalability. Cloud Firestore is used for mobile, web and IoT applications development to instantly sync data across devices using real-time listeners. Mobile, web and IoT apps can access database directly using native SDKs provided by Firebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADMfn7RjJhU4hOBYMC94BQ.png" /></figure><ul><li>Cloud Firestore uses a “Document and Collection” based structure to store data and does not contain any rows and tables.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezQJk67Md9UX9u-GYtUrwA.png" /></figure><ul><li>Data will be stored in documents organized into collections. The document supports key-values (the field can be any primitive data type, for example: int, string, etc.), complex and nested objects (called maps).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M8pnqpctRbOci3TC2JrMcg.png" /></figure><ul><li>All documents should be stored in collections and depending on your data model we may create sub-collections in documents.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jnk5gRdmySK9E9C24J8YCA.png" /></figure><ul><li>We cannot create a document within a document and it is the same as a collection.</li><li>A document cannot exist independently and always belongs to a collection.</li><li>We can easily refer to any document or collection in a database by its unique name.</li><li>A collection contains documents only and cannot contain any key-values or sub-collections.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l897a-8GnVvotjeXVlYxww.png" /></figure><ul><li>If you’re trying to add documents to a collection that doesn’t exist, it creates the collection for you.</li><li>If you delete all documents in a collection, that collection will be deleted automatically.</li></ul><h3><strong>Conclusion</strong></h3><p>In this article, we learned firebase, real-time database, cloud storage and cloud firestore. Thank you. See you in the next article…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ffb73f8346c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure Pipes In Angular]]></title>
            <link>https://enessyilmaz.medium.com/structure-pipe-in-angular-819b71dc7b3f?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/819b71dc7b3f</guid>
            <category><![CDATA[uppercase]]></category>
            <category><![CDATA[angular-pipe]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[lowercase]]></category>
            <category><![CDATA[pipes]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sun, 11 Dec 2022 14:15:23 GMT</pubDate>
            <atom:updated>2022-12-11T14:16:33.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6N5ItCnfNHJHFD6Ecopf1g.jpeg" /></figure><h3><strong>What is Angular Pipe?</strong></h3><p>A pipe takes in <em>data as input</em> and transforms it into an <em>output</em>. The pipe’s purpose is to allow the transformation of an existing value and reusability!</p><p>Pipes are simple functions to use in template expressions to accept an input value and return a transformed value. Pipes are useful because you can use them throughout your application, while only declaring each pipe once. For example, you would use a pipe to show a date as April 15, 1988 rather than the raw string format.</p><p>We can transform and reuse any data on the template without writing code in the component. Moreover, we can do this with high performance and immutable with Pipes. In addition, Pipes enable data to be processed while a workflow is in progress.</p><h3><strong>How to Use Angular Pipe?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*2Vs7NrLGH9XSZqJOML5XsQ.jpeg" /></figure><p>Angular has ready-made pipes that come with rxjs.</p><blockquote><strong><em>Pipes</em></strong></blockquote><h3><strong>1. DatePipe</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*30ZtI-T5oD7y0PwgVhpnPg.jpeg" /></figure><p>Angular date pipe is used to format dates in angular based on given date formats, timezone and country locale information.</p><p>Using the date channel we can convert a date object, a number (from UTC to milliseconds) or an ISO date string to given predefined angular date formats or custom angular date formats.</p><p>Angular date pipe accpets three parameters</p><ol><li>Format</li><li>Timezone</li><li>Locale</li></ol><p>I have created a date pipe component in my Angular project and added current datetime values in different formats like milliseconds,date object,datetime string,ISO datetime string.</p><pre>import { Component, OnInit } from &#39;@angular/core&#39;;<br><br>@Component({<br>  selector: &#39;app-datepipe&#39;,<br>  templateUrl: &#39;./datepipe.component.html&#39;,<br>  styleUrls: [&#39;./datepipe.component.scss&#39;]<br>})<br>export class DatepipeComponent implements OnInit {<br><br>  todayNumber: number = Date.now();<br>  todayDate : Date = new Date();<br>  todayString : string = new Date().toDateString();<br>  todayISOString : string = new Date().toISOString();<br><br>  constructor() { <br>    <br>  }<br>  <br>  ngOnInit() {<br>  }<br><br>}</pre><p>Now in my component I am displaying them using angular date pipe as shown below.</p><pre>&lt;p&gt;DateTime as Milliseconds : {{todayNumber}} <br>datepipe:{{todayNumber | date}}&lt;/p&gt;<br>&lt;p&gt;DateTime as object : {{todayDate}} <br>datepipe:{{todayDate | date}}&lt;/p&gt;<br>&lt;p&gt;DateTime as string : {{todayString}} <br>datepipe:{{todayString | date}}&lt;/p&gt;<br>&lt;p&gt;DateTime as iso string : {{todayISOString}} <br>datepipe:{{todayISOString | date}}&lt;/p&gt;<br><br>Output:<br>DateTime as Milliseconds : 1560617468681 <br>datepipe:Jun 15, 2019<br><br>DateTime as object : Sat Jun 15 2019 22:21:08 GMT+0530 <br>(India Standard Time) <br>datepipe:Jun 15, 2019<br><br>DateTime as string : Sat Jun 15 2019 <br>datepipe:Jun 15, 2019<br><br>DateTime as iso string : 2019-06-15T16:51:08.681Z <br>datepipe:Jun 15, 2019</pre><p>All types of datetime values displays the date in <strong>‘MMM d, y’</strong> format which is default Angular date format ‘mediumDate’</p><p>To change the datetime format in angular we have to pass date time format parameter to the angular pipe as shown below</p><pre>{{ date_value | date :&#39;short&#39;}}<br><br>// 6/15/19, 5:24 PM</pre><p>The format ‘short’ is one of the predefined date formats in angular which converts our date value to <strong>’M/d/yy, h:mm a’</strong> format.</p><h3><strong>2. UpperCasePipe</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*AHEkkCfmmVPkFP577hyknQ.png" /></figure><p>To convert string or text to uppercase in Angular we can use Angular UpperCase Pipe.</p><p>Pass input string to the uppercase pipe as shown below.</p><pre>&lt;p&gt;{{&#39;uppercasepipe convert string to uppercase in angular&#39;<br>| uppercase}}&lt;/p&gt;<br>&lt;!-- Output --&gt;<br>&lt;!--UPPERCASEPIPE CONVERT STRING TO UPPERCASE IN ANGULAR--&gt;</pre><p>Angular UpperCase Pipe is one of the built in pipes which converts text to uppercase.</p><p><strong>UpperCase Pipe Usage &amp; Syntax</strong></p><p>The syntax is very similar to other built in pipes, we need to pass input string to uppercase pipe without any parameters</p><pre>{{ string | uppercase }}</pre><p><strong>UpperCase Pipe Examples</strong></p><p>We go through the different types of strings and convert them to uppercase using Angular UpperCasePipe.</p><p>We will create a component called uppercase component in our Angular project, will convert different kind of inputs to uppercase.</p><pre>&lt;p&gt;{{&#39;angular uppercase&#39; | uppercase}}&lt;/p&gt;<br>&lt;!-- output is &quot;ANGULAR UPPERCASE&quot; --&gt; <br>&lt;!-- Ultra numeric string to uppercase --&gt;<br>&lt;p&gt;{{&#39;angular version 9&#39; | uppercase}}&lt;/p&gt; <br>&lt;!-- output is &quot;ANGULAR VERSION 9&quot; --&gt;</pre><p><strong>Error: InvalidPipeArgument for pipe ‘UpperCase Pipe’</strong></p><p>Angular uppercase pipe accepts only string types. If you pass other types like number or object etc. you will get <strong>Error</strong>: <strong>InvalidPipeArgument</strong> <strong>for</strong> pipe &#39;UpperCasePipe&#39; error.</p><pre>{{ 1 | uppercase}}</pre><p>The above code won’t compile at all and angular cli returns following error</p><pre>error TS2345: Argument of type &#39;1&#39; is not assignable <br>to parameter of type &#39;string&#39;.</pre><p>We will test uppercase pipe with other type variables.</p><pre>export class UpperCasePipeComponent implements OnInit {</pre><pre>id : number;<br>products : Product[];</pre><pre>constructor() { <br>    this.id = 123;<br>    this.products = [<br>       {id:1,name:&quot;product1&quot;},<br>       {id:2,name:&quot;product2&quot;}<br>    ];<br>}</pre><pre>}  <br></pre><pre>interface Product{<br>  id: number;<br>  name : string;<br>}</pre><p>And now angular cli will return error TS2345: Argument of <strong>type</strong> &#39;number&#39; is not assignable to parameter of <strong>type</strong> &#39;string&#39;. error when we try to execute below code.</p><pre>{{ id | uppercase}}</pre><p>Same with the type product</p><pre>{{ products | uppercase}}</pre><pre> error TS2345: Argument of type &#39;Product[]&#39; is not <br> assignable to parameter of type &#39;string&#39;.</pre><p>Now we will test uppercase pipe with variable of type any.</p><pre>uppercasevariable: any;</pre><pre> constructor(){<br>   this.uppercasevariable = 1;<br> }<br></pre><pre> {{ uppercasevariable | uppercase}}</pre><p>And now there will be no compile time errors and at run time we will get following error.</p><p>Error: InvalidPipeArgument: ‘1’ for pipe ‘UpperCasePipe’</p><p>and in addition to that you will get another error</p><p>Error: ASSERTION ERROR: Stored value should never be NO_CHANGE. [Expected=&gt; [object Object] !== [object Object] &lt;=Actual]</p><p>If you pass object to uppercase pipe you will get following error. I mean when I assign a object to variable type of any.</p><p>Error: InvalidPipeArgument: ‘[object Object]’ for pipe ‘UpperCasePipe’</p><p>If you assign string to any type variable uppercase pipe will work as expected.</p><h3><strong>3. LowerCasePipe</strong></h3><p>To convert a string to small letters in template HTML file, pass the input string to the lowercase pipe using pipe operator as shown below.</p><pre>&lt;p&gt;{{&#39;LOWERCASE pipe convert string to small letters in ANGULAR&#39;<br>| lowercase}}&lt;/p&gt;<br>&lt;!-- Output --&gt;<br>&lt;!--lowercase pipe convert string to small letters in angular--&gt;</pre><p>It’s one of the built-in pipes in Angular and very handy pipe similar to uppercase pipe.</p><p><strong>Lowercase Pipe Usage &amp; Syntax</strong></p><p>The syntax is very similar to other built in pipes, we need to pass input text to the lowercase pipe without any parameters.</p><pre>{{ text | lowercase }}</pre><p><strong>LowerCase Pipe Examples</strong></p><p>Now We will go through the different types of strings and convert them to small case letters using Angular LowerCase Pipe.</p><p>Let’s create a component called lowercasepipe in our Angular project.</p><pre>ng generate component lowercasepipe </pre><pre>//<br>CREATE src/app/lowercasepipe/lowercasepipe.component.html (28 bytes)<br>CREATE src/app/lowercasepipe/lowercasepipe.component.spec.ts (677 bytes)<br>CREATE src/app/lowercasepipe/lowercasepipe.component.ts (304 bytes)<br>CREATE src/app/lowercasepipe/lowercasepipe.component.scss (0 bytes)<br>UPDATE src/app/app.module.ts (3991 bytes)</pre><pre>import { Component, OnInit } from &#39;@angular/core&#39;;</pre><pre>@Component({<br>  selector: &#39;app-lowercasepipe&#39;,<br>  templateUrl: &#39;./lowercasepipe.component.html&#39;,<br>  styleUrls: [&#39;./lowercasepipe.component.scss&#39;]<br>})<br>export class LowercasepipeComponent implements OnInit {</pre><pre>  constructor() { }</pre><pre>  ngOnInit(): void {<br>  }</pre><pre>}</pre><p>Convering ultra numerica string to lowercase</p><pre>&lt;p&gt;{{&#39;ANGULAR LOWERCASE&#39; | lowercase}}&lt;/p&gt;<br>&lt;!-- output is &quot;angular lowercase&quot; --&gt; </pre><pre>&lt;!-- Ultra numeric string to lowercase --&gt;<br>&lt;p&gt;{{&#39;ANGULAR version 11&#39; | lowercase}}&lt;/p&gt; <br>&lt;!-- output is &quot;angular version 11&quot; --&gt;</pre><p><strong>Error: InvalidPipeArgument for pipe ‘LowerCase Pipe’</strong></p><p>Angular lowercase pipe accepts <strong>only string types</strong>.</p><p>If we pass other types like number or object etc. we will get<br><strong>Error: InvalidPipeArgument for pipe &#39;LowerCasePipe&#39;</strong> error.</p><pre>{{ 1 | lowercase}}</pre><p>The above code won’t compile and angular cli returns following error</p><pre>TS2345: Argument of type &#39;1&#39; is not assignable to parameter of type &#39;string&#39;.</pre><p>We will test lowercase pipe with other type variables.</p><pre>export class LowercasepipeComponent implements OnInit {</pre><pre>id : number;<br>products : Product[];</pre><pre>constructor() { <br>    this.id = 123;<br>    this.products = [<br>       {id:1,name:&quot;product1&quot;},<br>       {id:2,name:&quot;product2&quot;}<br>    ];<br>}</pre><pre>}  <br></pre><pre>interface Product{<br>  id: number;<br>  name : string;<br>}</pre><p>In file lowercasepipe.component.html file</p><pre>{{ id | lowercase}}</pre><p>And now angular cli will return error TS2345: Argument of <strong>type</strong> &#39;number&#39; is not assignable to parameter of <strong>type</strong> &#39;string&#39;. error when we try to compile below code.</p><p>Same with the type product</p><pre>{{ products | lowercase}}</pre><pre> error TS2345: Argument of type &#39;Product[]&#39; is not <br> assignable to parameter of type &#39;string&#39;.</pre><p>Now we will test lowercase pipe with variable of type any.</p><pre>lowercasevariable: any;</pre><pre> constructor(){<br>   this.lowercasevariable = 1;<br> }<br></pre><pre> {{ lowercasevariable | lowercase}}</pre><p>And now there will be no compile time errors and at run time we will get following error.</p><p>Error: Invalid Pipe Argument: ‘1’ for pipe ‘Lower Case Pipe’</p><p>If you pass object to lowercase pipe you will get following error.</p><p>I mean when we assign a object to variable type of any.</p><p>Error: Invalid Pipe Argument: ‘[object Object]’ for pipe ‘LowerCasePipe’</p><p>If you assign string to any type variable lowercase pipe will work as expected.</p><h3>3. Currency Pipe</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*vNGxg-CFr9b6fhaaCnSBQw.png" /></figure><p>Angular Currency Pipe is one of the built in pipe in Angular used to format currency value according to given country code,currency,decimal,locale information.</p><p><strong>How to use Angular Currency Pipe</strong></p><p>Angular Currency Pipe takes currency value as input and currency Code, display, digits Info and locale as parameters as shown below</p><pre>{{currency_value|currency[:currencyCode[:display[:digitsInfo[:locale]]]]}}</pre><p>Parameter Description currency Code ISO 4217 currency code.Of type string default value undefined, Optional display We can display Currency ‘symbol’ or ‘code’ or ‘symbol-narrow’ or our own string.Of type string, Optional Default value is ‘symbol’ digits Info Represents Decimal representation of currency value.Of type string default value undefined, Optional locale represents locale format rules. Default value is our project locale if set or undefined.Optional</p><p><strong>Angular Currency Pipe example</strong></p><p>We will go through few examples to understand Angular Currency Pipe.For example we have Currency of Value 100.23.</p><pre>&lt;!--output &#39;$100.23&#39;--&gt;<br>&lt;p&gt;{{Value | currency}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;₹100.23&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;INR&#39;}}&lt;/p&gt;</pre><p>If you are not passing any parameters then it displays the default currency as USD i.e., dollars.</p><p>We can change this default currency as explained below.</p><p>If we are passing currency code to the angular currency pipe.It will display the corresponding default currency symbol.</p><p>I am passing currency code as “INR” and Rupee symbol will be displayed.</p><p><strong>Angular Currency Pipe without symbol</strong></p><p>If you want to display your own name instead of default currency symbol you have to pass display parameter.</p><p>The display parameter can be “code” (currency code will be displayed) or “symbol” or “symbol-narrow” or any other custom value.</p><pre>&lt;!--output &#39;INR100.23&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;INR&#39;:&#39;code&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;CA$100.23&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;CAD&#39;:&#39;symbol&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;$100.23&#39;--&gt;<br>&lt;p&gt;{{Value |currency:&#39;CAD&#39;:&#39;symbol-narrow&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;₹100.23&#39;--&gt;<br>&lt;p&gt;{{Value |currency:&#39;INR&#39;:&#39;symbol-narrow&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;Indian Rupee100.23&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;INR&#39;:&#39;Indian Rupee&#39;}}&lt;/p&gt;</pre><p>Few countries like Canada have two currency codes like symbol CA$ and symbol-narrow $. If the country locale does not have symbol-narrow, default symbol will be displayed.</p><p>Indian rupee does not have symbol-narrow so the default rupee symbol displayed.</p><p>If you want to display your own custom name as symbol you can pass as a parame ter as shown in last example.I am passing ‘Indian Rupee’ as display parameter.</p><p><strong>Angular Currency Pipe No Decimal</strong></p><p>If you want to customize the decimal points of currency value. You need to pass digit Info parameter.</p><p>The syntax of the digit Info parameter is “numberOfInteger:minimumFractions-maxFractions”.</p><pre>&lt;!--output &#39;₹0,100.35&#39;--&gt;<br>&lt;p&gt;{{Value |currency:&#39;INR&#39;:&#39;symbol&#39;:&#39;4.2-2&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;₹100.2&#39;--&gt;<br>&lt;p&gt;{{Value |currency:&#39;INR&#39;:&#39;symbol&#39;:&#39;3.1-1&#39;}}&lt;/p&gt;</pre><p>The first example displayed as “₹0,100.35” because we are telling the currency pipe to display at least 4 digits. Remaining one digit adjusted with 0.</p><p>And after the decimal point minimum 2 fractions and maximum 2 fractions are displayed.</p><p>In the second example I am passing fractions as ‘1–1’. So it displayed as “₹100.2”.</p><p>Angular Currency Pipe by default displays two decimal points irrespective of currency type. If currency is 100.</p><pre>&lt;!--₹100.00--&gt;<br>&lt;p&gt;{{IntegerValue |currency:&#39;INR&#39;:&#39;symbol&#39;}}&lt;/p&gt;</pre><p>To remove decimal points from the Angular currency pipe, we need to pass digit Info parameter fractions as zero.</p><pre>₹100<br>&lt;p&gt;{{IntegerValue |currency:&#39;INR&#39;:&#39;symbol&#39;:&#39;3.0&#39;}}&lt;/p&gt;</pre><p>Few country currencies does not support cent values in that case decimal points are truncated. For example Chilean peso Currency CLP does not support cents. So if the currency value is 100.23. It is displayed as 100.</p><p>You can see the below table for list of such countries.</p><pre>CLP100<br>&lt;p&gt;{{Value | currency:&#39;CLP&#39;:&#39;symbol&#39;}}&lt;/p&gt;</pre><p><strong>Angular Currency Pipe example with locale</strong></p><p>We can pass local as parameter to Angular currency Pipe as shown below.</p><pre>&lt;p&gt;{{Value | currency:&#39;CAD&#39;:&#39;symbol&#39;:&#39;4.2-2&#39;:&#39;fr&#39;}}&lt;/p&gt;</pre><p>But the above code returns the error in console saying Missing locale data for the locale “fr”.</p><p>We are passing french locale information as “fr”. But in our application we don’t have locale information for french.</p><p>We need to register the locale information.</p><pre>import { registerLocaleData } from &#39;@angular/common&#39;;<br>import localeFr from &#39;@angular/common/locales/fr&#39;;<br>registerLocaleData(localeFr, &#39;fr&#39;);</pre><p>Follow the below steps to use Angular Currency Pipe with locale.</p><ol><li>Import the register Locale Data from @angular/common</li><li>Import locale Information from @angular/common/locales/fr.</li><li>And Finally register the information using register Locale Data method.</li></ol><pre>&lt;!--output &#39;0 100,23 $CA&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;CAD&#39;:&#39;symbol&#39;:&#39;4.2-2&#39;:&#39;fr&#39;}}&lt;/p&gt;</pre><pre>&lt;!--output &#39;100,23 $CA&#39;--&gt;<br>&lt;p&gt;{{Value | currency:&#39;CAD&#39;:&#39;symbol&#39;:&#39;3.2-2&#39;:&#39;fr&#39;}}&lt;/p&gt;</pre><p><strong>Display Currency symbol to the right using Angular Currency Pipe</strong></p><p>A lot of europe countries use the currency symbol at the right side of currency value (France, Germany, Spain, Italy countries).</p><p>If you pass the locale information the symbol will be automatically displayed at the right side of value as shown in above french locale.</p><p>But the remaining currencies without locale still displays currency symbol to the left only.</p><pre>import {NgModule, LOCALE_ID} from &#39;@angular/core&#39;;</pre><pre>@NgModule({<br> providers: [{<br>   provide: LOCALE_ID,<br>   useValue: &#39;fr&#39; // &#39;de&#39; for Germany, &#39;fr&#39; for France ...<br>  }]<br>})</pre><p>Import LOCALE_ID from ‘@angular/core’ and pass it to the provides as shown above.</p><p>But this will change the <em>locale</em> across the application. So this approach is acceptable only if your site is using single locale information.</p><p>And the decision to show the currency symbol to the left or right should be based upon locale information only.</p><p>So its better to pass locale information to the Angular Currency Pipe whenever required.</p><p><strong>Creating Custom Angular Currency Pipe</strong></p><p>What if we want to change default parameters of Angular Currency Pipe like default currency code,default currency symbol, default decimal locations and default locale?</p><p>For example we have a fixed currency format across the application as shown below.</p><pre>{{ Value | currency:&#39;EUR&#39;:&#39;symbol&#39;:&#39;3.2-2&#39;:&#39;fr&#39; }}<br>100,23 €</pre><p>Each time I do not want to pass the other parameters and set the above parameters as default parameters so that the below code should display the required format.</p><pre>{{ Value | currency }}<br>100,23 €</pre><p>There is no way we can set the default parameters in Angular Currency Pipe. But we can define our own custom Angular currency Pipe to do the same.</p><p>Create a new file called <em>custom.currencypipe.ts</em> file and add the below code to it. You can change the paramters as per your requirements.</p><pre>import { Pipe, PipeTransform } from &#39;@angular/core&#39;;<br>import { formatCurrency, getCurrencySymbol } from &#39;@angular/common&#39;;<br>@Pipe({<br>    name: &#39;mycurrency&#39;,<br>  })<br>  export class MycurrencyPipe implements PipeTransform {<br>    transform(<br>        value: number,<br>        currencyCode: string = &#39;EUR&#39;,<br>        display:<br>            | &#39;code&#39;<br>            | &#39;symbol&#39;<br>            | &#39;symbol-narrow&#39;<br>            | string<br>            | boolean = &#39;symbol&#39;,<br>        digitsInfo: string = &#39;3.2-2&#39;,<br>        locale: string = &#39;fr&#39;,<br>    ): string | null {<br>        return formatCurrency(<br>          value,<br>          locale,<br>          getCurrencySymbol(currencyCode, &#39;wide&#39;),<br>          currencyCode,<br>          digitsInfo,<br>        );<br>    }<br>}</pre><p>And after declaring _MyCurrencyPipe._ Import it in <em>app.module.ts</em> file and add it in declaration array of _app.module.ts. _As shown below.</p><pre>import {MycurrencyPipe} from &#39;./custom.currencypipe&#39;;</pre><pre>@NgModule({<br>  declarations: [<br>    MycurrencyPipe<br>]);</pre><p>Now i can use my custom currency pipe as show below.</p><pre>{{ Value | mycurrency }}<br>100,23 €</pre><h3>5. Decimal Pipe</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6SxTgpqRXyTHA5KoiAGkQQ.jpeg" /></figure><p>Angular Decimal Pipe is one of the bulit in pipe in Angular used to format decimal numbers according to the given decimal digits info and locale information.</p><p><strong>How to use Angular Decimal Pipe</strong></p><p>Angular decimal pipe acceps two parameters</p><ol><li>decimal digit info</li><li>locale</li></ol><pre>{{ numeric_value | number [ : digitsInfo [ : locale ] ] }}</pre><p><strong>Angular Decimal Pipe Examples</strong></p><p>Now we will go through few angular decimal pipe examples to understand it further.</p><p>I created a decimal pipe component in my Angular project and added decimal number variable called decimal_value.</p><pre>import { Component, OnInit } from &#39;@angular/core&#39;;</pre><pre>@Component({<br>  selector: &#39;app-decimalpipe&#39;,<br>  templateUrl: &#39;./decimalpipe.component.html&#39;,<br>  styleUrls: [&#39;./decimalpipe.component.scss&#39;]<br>})<br>export class DecimalpipeComponent implements OnInit {</pre><pre>  decimal_value: number = 5.123456789;</pre><pre>  constructor() { }<br>  ngOnInit() {<br>  }</pre><pre>}</pre><p>First we will use decimal pipe without parameters.</p><pre>No Parameters:<br>{{ decimal_value | number }}</pre><pre>// No Parameters: 5.123</pre><p>As explained above if none of the decimal digit info is given, then decimal pipe will take default options, 1 interger value before decimal point and 3 fraction digits after decimal point.</p><p>So the above code is same as</p><pre>{{ decimal_value | number:&#39;1.0-3&#39; }}</pre><p>Now we will pass digit informaion paramter to decimal pipe and see how it works</p><pre>Digit Info Parameter (3.1-5):<br>{{ decimal_value | number:&#39;3.1-5&#39; }}</pre><p>In the above code we are instructing decimal pipe to show atleast 3 integer values before decimal points and minimum 1 fraction digit, maximum 5 fraction digits.</p><pre>Digit Info Parameter (3.1-5): 005.12346</pre><p>As our decimal value contains only single digit before decimal point two extra zeroes are padded two satisfy given digit info.</p><p><strong>Angular decimal pipe example with country locale</strong></p><p>To display numbers according to country locale format rules, We have to pass country locale code as a second parameter to angular decimal pipe.</p><p>To display number in french locale in Angular use locale code ‘fr’ as parameter as shown below.</p><pre>Decimal pipe with locale france<br>{{decimal_value | number:&#39;4.5-5&#39;:&#39;fr&#39;}}</pre><p>If you execute above code you will get following error in console.</p><pre>InvalidPipeArgument: &#39;Missing locale data for the locale &quot;fr&quot;.&#39; <br>for pipe &#39;DecimalPipe&#39;</pre><p>Because In our application we dont have locale information for ‘fr’</p><p>To add the country locale information refer Angular currency pipe article.</p><p>After adding locale information you can see the number has been displayed according to france locale rules.</p><pre>Decimal pipe with locale france 0 005,12346</pre><p><strong>Angular Decimal Pipe rounding</strong></p><p>By default Angular decimal pipe rounds off the number to the nearest value using Arithmetic rounding method.</p><pre>numeric_value : number = -2.15;</pre><pre>{{ numeric_value | number:&#39;1.1-1&#39;}}<br>// -2.2</pre><pre>numeric_value : number = -2.11;</pre><pre>{{ numeric_value | number:&#39;1.1-1&#39;}}<br>// -2.1</pre><p>This is different from JavaScript’s Math.round() function.</p><p>For example if the number is -2.5</p><pre>{{value | number : &#39;1.0-0&#39;}}<br>// -3.</pre><pre>Math.round(value)<br>//-2</pre><p>If the number is -2.1</p><pre>{{value | number : &#39;1.0-0&#39;}}<br>//-2</pre><pre>// rounding_value : number = 2.23;<br>{{ rounding_value | number : &#39;1.1-1&#39;}}<br>2.2</pre><pre>// rounding_value : number = 2.25;<br>{{ rounding_value | number : &#39;1.1-1&#39;}}<br>2.3</pre><p><strong>Rounding Angular number to 2 decimal points</strong></p><p>In most of the real world cases, we will round off numbers to 2 decimal places.</p><p>So using decimal pipe we can easily format numbers in Angular upto 2 decimal points by passing digit info as x.2-2 (x is number of digits before decimal points)</p><pre>// rounding_value : number = 2.25234234234;<br>{{ rounding_value | number : &#39;1.2-2&#39;}}</pre><pre>// 2.25</pre><p><strong>Angular Decimal Pipe with No decimal points</strong></p><p>If you want to remove decimal points and rounding to nearest integet values we can pass digit info as x.0-0. (x is minimum number of digits before decimal)</p><pre>//decimal_value: number = 5.123456789;</pre><pre>Without decimal<br>{{decimal_value | number:&#39;1.0-0&#39;}}<br>// 5</pre><pre>//decimal_value: number = 5.523456789;</pre><pre>{{decimal_value | number:&#39;1.0-0&#39;}}<br>//6</pre><p><strong>How to use decimal pipe in Components in Angular</strong></p><p>As explained in How To Use Angular Pipes in Components &amp; Service ts files article.</p><p>Follow the below steps to use decimal pipe in components</p><ol><li>Import DecimalPipe from @angular\common in app.module.ts file</li><li>Add the DecimalPipe to provider array.</li><li>Inject the DecimalPipe in component constructor file using dependency injection.</li><li>And finally format the numbers using decimal pipe transform method as shown below.</li></ol><pre>export class DecimalpipeComponent implements OnInit {</pre><pre>  decimal_value: number = 5.123456789;<br>  constructor(private _decimalPipe: DecimalPipe) {<br>     var decimal_formatted = <br>         this._decimalPipe.transform(this.decimal_value,&quot;1.2-2&quot;)<br>     console.log(decimal_formatted);<br>  }<br>}</pre><pre>// In console 5.12</pre><p><strong>format Number() method in Angular</strong></p><p>The above approach requires us to inject decimal pipe in constructor.</p><p>Instead of that we can use formatNumber() method to format numbers in component and service files similarly as decimal pipe.</p><p>We can import formatNumber() from @angular/common and use it in component file.</p><pre>import { Component, OnInit, Inject, LOCALE_ID } from &#39;@angular/core&#39;;<br>import { DecimalPipe,formatNumber } from &#39;@angular/common&#39;;</pre><pre>export class DecimalpipeComponent implements OnInit {</pre><pre>  decimal_value: number = 5.123456789;<br>  constructor(@Inject(LOCALE_ID) private locale: string) {<br>      var formattedNumber= <br>      formatNumber(this.decimal_value,this.locale,&#39;1.2-2&#39;);<br>      console.log(formattedNumber);<br>}</pre><pre>// In console 5.12</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*dIaqFdJjJPrEBNfx.png" /></figure><p><strong>Removing Comma from number angular decimal pipe</strong></p><p>Angular decimal pipe adds commas to the number according to counry locale rules.</p><pre>//decimal_value: number = 55234.342342;</pre><pre>{{decimal_value | number:&#39;1.2-2&#39;}}<br>55,234.34</pre><p>And there is no direct way to remove those commas from number using decimal pipe.</p><p>For that purpose we need to create our own custom pipe which removes commas from formatted number.</p><pre>import { Pipe, PipeTransform } from &#39;@angular/core&#39;;</pre><pre>@Pipe({<br>  name: &#39;removeComma&#39;<br>})<br>export class RemoveCommaPipe implements PipeTransform {</pre><pre>  transform(value: string): string {<br>    if (value !== undefined &amp;&amp; value !== null) {<br>      return value.replace(/,/g, &quot;&quot;);<br>    } else {<br>      return &quot;&quot;;<br>    }<br>  }<br>}</pre><p>And we need apply this removeComma Pipe after using decimal pipe.</p><pre>{{decimal_value | number:&#39;1.2-2&#39; | removeComma}}</pre><pre>//55234.34</pre><p><strong>Error: InvalidPipeArgument: ‘not a valid digit info’ for pipe ‘DecimalPipe’</strong></p><p>We need to pass digit information parameter in following format “X.X-X”</p><pre>{minimumIntegerDigits}.{minimumFractionDigits}-{maximumFractionDigits}</pre><p>If you pass the parameter in wrong format for instance as shown below</p><pre>{{decimal_value | number:&#39;1-2.2&#39;}}</pre><p>You will get following error in console.</p><p>Error: InvalidPipeArgument: ‘1–2.2 is not a valid digit info’ for pipe ‘DecimalPipe’</p><h3>6.Percent Pipe</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32b6-BsAbFcKmzw67CnC4A.jpeg" /></figure><p>Transforms a number to a percentage string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.</p><p>Angular PercentPipe is an angular Pipe API that formats a number as a percentage according to locale rules. It belongs to <strong>CommonModule</strong>. Find the syntax.</p><p><strong>number_expression | percent[:digitInfo]</strong></p><p>Find the description.<br><strong>number_expression</strong>: An angular expression that will give output a number.<br><strong>percent </strong>: A pipe keyword that is used with pipe operator and it converts number into percent.<br><strong>digitInfo</strong>: It defines a percentage format. We have described the use of <strong>digitInfo</strong> in DecimalPipe section. It is used with following syntax.</p><p><strong>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</strong></p><p>Now find some sample examples.<br>1. Using default format:</p><p>minIntegerDigits = 1<br>minFractionDigits = 0<br>maxFractionDigits = 3</p><p>Now find a number that will be changed into percentage.</p><pre>num1 = 2.5;</pre><p>Now use Percent Pipe</p><pre>{{num1 | percent}}</pre><p>Find the output.</p><pre>250%</pre><p>2. Use format <strong>‘2.2–5’</strong><br>minIntegerDigits = 2<br>minFractionDigits = 2<br>maxFractionDigits = 5</p><p>Now find the number that will be changed into percentage.</p><pre>num1 = 2.5;</pre><p>Now use Percent Pipe.</p><pre>{{num1 | percent:&#39;2.2-5&#39;}}</pre><p>Find the output.</p><pre>250.00%</pre><p>We will observe that there is two digits in fraction part. This is because minimum fraction digits required is 2.</p><p>Now find the component used in our example.<br><strong>percentpipe.component.ts</strong></p><pre>import { Component } from &#39;@angular/core&#39;;<br>@Component({<br>  selector: &#39;percent-app&#39;,<br>  template: `<br>            &lt;h3&gt;Percent Pipe&lt;/h3&gt;<br>	    &lt;div&gt;<br>	      &lt;p&gt; {{num1 | percent}} &lt;/p&gt;<br>	      &lt;p&gt; {{num1 | percent:&#39;2.2-5&#39;}} &lt;/p&gt;<br>	      &lt;p&gt; {{num2 | percent:&#39;1.2-5&#39;}} &lt;/p&gt;<br>	      &lt;p&gt; {{num1 * num2 | percent:&#39;1.2-3&#39;}} &lt;/p&gt;<br>	    &lt;/div&gt;<br>         ` <br>})<br>export class PercentPipeComponent {<br>  num1: number = 2.5;<br>  num2: number = 0.5;<br>}</pre><p>Find the output.</p><pre>Percent Pipe<br>250%<br>250.00%<br>50.00%<br>125.00%</pre><h3>Conclusion</h3><p>In this article, we learned the structure of angular pipes and how to use them. Thank you. See you in the next article…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=819b71dc7b3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure Service In Angular]]></title>
            <link>https://enessyilmaz.medium.com/structure-service-in-angular-d0f266326f1e?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0f266326f1e</guid>
            <category><![CDATA[servis]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[function]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sat, 12 Nov 2022 00:02:38 GMT</pubDate>
            <atom:updated>2022-11-12T00:02:38.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="image" src="https://cdn-images-1.medium.com/max/1024/1*_PE21A-z40tYEexxvY1mVw.jpeg" /></figure><p><strong>1.What İs Service?</strong></p><p>Angular services are objects that get instantiated just once during the lifetime of an application. They contain methods that maintain data throughout the life of an application, data is available all the time.</p><p><strong>2. What is Angular Services used for?</strong></p><ul><li>Share logic or data between components<br>-Encapsulate external interactions such as data access<br>-Services are easier to test.<br>-Debugging is easier.<br>-We can reuse the service in many places.</li></ul><p>The application, we might see a search form where we can enter a search term and get a list of products that match that term. After that, we might click a given product to visit that product’s details page.Because our app is client-side, it’s not technically required that we change the URL when we change“pages”. But it’s worth thinking about for a minute: what would be the consequences of using the same URL for all pages?</p><ol><li>You wouldn’t be able to refresh the page and keep your location within the app</li><li>You wouldn’t be able to bookmark a page and come back to it later</li><li>You wouldn’t be able to share the URL of that page with others</li></ol><p>Or put in a positive light, routing lets us define a URL string that specifies where within our app a user should be. In our inventory example we could determine a series of different routes for each activity, for instance:The initial root URL could be represented by<strong> <em>http://our-app/.</em> </strong>When we visit this page, we could be redirected to our “home” route at <strong>http://our-app/home.</strong> When accessing the ‘About Us’ area, the URL could become <strong><em>http://our-app/about</em>.</strong> This way if we sent the <em>URL </em><strong><em>http://our-app/about</em></strong> to another user they would see same page.</p><p><strong>3.How To Create Service?</strong></p><blockquote>Step:</blockquote><p><strong>ng g service &lt;service_name&gt;</strong></p><p>Example;</p><p><strong>ng g service new_module/services/testservices</strong></p><figure><img alt="image 1" src="https://cdn-images-1.medium.com/max/1024/1*hLOqjLoaEZq1E_atfdZvmQ.png" /></figure><figure><img alt="image 2" src="https://cdn-images-1.medium.com/max/521/1*ser8XhvT-74ZLGKFsVrLpA.png" /></figure><figure><img alt="image 3" src="https://cdn-images-1.medium.com/max/684/1*G9d04FmJ5y0f3_c4ZOvrqw.png" /></figure><p><strong>4.How To Use it?</strong></p><blockquote>Step 1: We define some variables in the service file.</blockquote><blockquote>! For large projects, data will come from database or APIs.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*L5MSaLlKo_7Fil5bRlnzQg.png" /></figure><blockquote>Step 2 : We integrate our service in app module file.</blockquote><blockquote>We define in providers</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*6Z6F0sLJv9M6PFMAE2at3g.png" /></figure><blockquote>Step 3: We integrate our service into app component file.<br>We create the Functions to get the data from the Service.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*qnFhzVg_dPHelLuMMwwBzQ.png" /></figure><blockquote>Step 4: We call it in app component html file to present our data to UI</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*B9moeFsRbE4_KJHzTE4vjQ.png" /></figure><blockquote>Step Finally: Result</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*iPVomHaxm9C7ymrmkDCN5A.png" /></figure><h3>Conclusion</h3><p>In this article, we learned to what is angular service is and learned how to use it.Thank you. See you in the next article…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0f266326f1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure Routing In Angular]]></title>
            <link>https://enessyilmaz.medium.com/structure-routing-in-angular-d886d9f223b9?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d886d9f223b9</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[route]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[router]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Tue, 08 Nov 2022 13:34:40 GMT</pubDate>
            <atom:updated>2022-11-08T13:34:40.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*UZ8DLJ1JV5Gkrg6AKRb3hQ.jpeg" /></figure><ol><li><strong>What is Routing?</strong></li></ol><p>The routing process allows you to dynamically update different pages and sections on a single page within your application. Another feature is that it provides manageability and ease of access by providing a distributed architecture in the project.</p><p><strong>2. Why Do We Need Routing?</strong></p><p>Defining routes in our application is useful because we can:</p><ul><li>separate different areas of the app;</li><li>maintain the state in the app;</li><li>protect areas of the app based on certain rules;</li></ul><p>The application, we might see a search form where we can enter a search term and get a list of products that match that term. After that, we might click a given product to visit that product’s details page.Because our app is client-side, it’s not technically required that we change the URL when we change“pages”. But it’s worth thinking about for a minute: what would be the consequences of using the same URL for all pages?</p><ol><li>You wouldn’t be able to refresh the page and keep your location within the app</li><li>You wouldn’t be able to bookmark a page and come back to it later</li><li>You wouldn’t be able to share the URL of that page with others</li></ol><p>Or put in a positive light, routing lets us define a URL string that specifies where within our app a user should be. In our inventory example we could determine a series of different routes for each activity, for instance:The initial root URL could be represented by <em>http://our-app/.</em> When we visit this page, we could be redirected to our “home” route at http://our-app/home. When accessing the ‘About Us’ area, the URL could become <em>http://our-app/about</em>. This way if we sent the <em>URL http://our-app/about</em> to another user they would see same page.</p><p><strong>3. The Angular Router Module</strong></p><p>The Router is a separate module in Angular. It is in its own library package, <em>@angular/router</em>. The Router Module provides the necessary service providers and directives for navigating through application views.</p><p>Using Angular Router you can</p><ul><li>Navigate to a specific view by typing a URL in the address bar</li><li>Pass optional parameters to the View</li><li>Bind the clickable elements to the View and load the view when the user performs application tasks</li><li>Handles back and forward buttons of the browser</li><li>Allows you to dynamically load the view</li><li>Protect the routes from unauthorized users using Guards</li></ul><p><strong>4. How to use router in angular</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*WawRTDrDBf2OWbIGIsuynA.png" /></figure><p>To use Routing in Angular, you must first add the Router Module in the app.module.ts file and specify that you will use it. For this, in the app.module.ts file</p><pre>import { RouterModule } from &#39;@angular/router&#39;;</pre><p>The file should be attached by typing the line. For usage, it should be specified that it will be used in the imports section in NgModule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*kGV68jEfMIZAEqecBXjqFQ.png" /></figure><p><strong>App.Routing.Module.ts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XiNmAKwsy_tW2lKYz8hJSw.png" /></figure><p><strong>Path:</strong> When the route specified here is entered as a url, that defined object does the job. So for the object to work in the example, the url should be “localhost:4200”.</p><p><strong>RedirectTo:</strong> You specify where to redirect. Here it will redirect to localhost:4200/home.</p><p><strong>PathMatch:</strong> Defined as “prefix” by default. If we do not say full here, we will get an error. The reason is the path field is empty. So there is no path to prefix. Let me explain the difference like this;</p><p>When it is defined as Prefix, for example, if our path was example, even if the localhost:4200/example/abc url was entered, it would still be directed to home because it has an example prefix. But when pathMatch value is full, urlin expects to match exactly, so if we enter localhost:4200/example/abc, pathMatch would give us a nice big error in Angular console when full.</p><pre>{ path: &#39;home&#39;, component: HomeComponent }</pre><p>When the url is entered as localhost:4200/home, it directs us to the Home Component. In other words, our Home Component is working between the <strong>&lt;router-outlet&gt; &lt;router-outlet&gt;</strong> tags.</p><p><strong>How can a rotuing be done to catch an undefined url?</strong><br>For this process, known as page not found or 404 error, you need to add a “**” as a path in the variables you define as root and write the component you want to redirect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*I_4RdnmsIGa1vVv77BU90w.png" /></figure><p><strong>5. Components of Angular Router Module</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpzY_bWkrvVKWBZ7ex6LzQ.jpeg" /></figure><p><strong>5.1 Router</strong></p><p>The Angular Router is an object that enables navigation from one component to the next component as users perform application tasks like clicking on menus links, buttons or clicking on back/forward button on the browser. We can access the router object and use its methods like navigate() or navigateByUrl(), to navigate to a route.</p><p><strong>5.2 Routes</strong></p><p>Routes is an array of Route objects our application supports</p><p><strong>5.3 RouterOutlet</strong></p><p>The outerOutlet is a directive (&lt;router-outlet&gt;) that serves as a placeholder, where the Router should display the view.</p><p><strong>5.4 RouterLink</strong></p><p>The RouterLink is a directive that binds the HTML element to a Route. Clicking on the HTML element, which is bound to a RouterLink, will result in navigation to the Route. The RouterLink may contain parameters to be passed to the route’s component.</p><p><strong>5.5 RouterLinkActive</strong></p><p>RouterLinkActive is a directive for adding or removing classes from an HTML element that is bound to a RouterLink. Using this directive, we can toggle CSS classes for active RouterLinks based on the current RouterState.</p><p><strong>5.6 ActivatedRoute</strong></p><p>The ActivatedRoute is an object that represents the currently activated route associated with the loaded Component.</p><p><strong>5.7 RouterState</strong></p><p>The current state of the router including a tree of the currently activated routes together with convenience methods for traversing the route tree.</p><p><strong>5.8 RouteLink Parameters array</strong></p><p>The Parameters or arguments to the Route. It is an array which you can bind to RouterLink directive or pass it as an argument to the Router.navigate method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCAB-GjGnu2tpUubJ7nPrQ.png" /></figure><p><strong>6. How to configure Angular Router</strong></p><p><strong>6.1 Set the &lt;base href&gt;</strong></p><p>The HTML &lt;base&gt; element specifies the base URL to use for all relative URLs contained within a document.</p><p>The Angular Router uses the HTML5 style of Routing (or PathLocationStrategy) as the default option. The router makes use of the browser’s history API for navigation and URL interaction.</p><p><strong>&lt;base href=”/”&gt;</strong></p><p>To make HTML5 routing to work, we need to set up the “<strong>base href”</strong> in the DOM. This is done in app’s <em>index.html</em> file immediately after the head tag.</p><p><strong>6.2 Map Action to Routes</strong></p><p>Next, we need to bind the click event of the link, image or button to a route. This is done using the routerlink directive</p><p><strong>&lt;li&gt;&lt;a [routerLink]=”[‘product’]”&gt;Product&lt;/a&gt;&lt;/li&gt;</strong></p><p>The routerLink directive accepts an array of route names along with parameters. This array is called as <strong>Link Parameters array</strong>.</p><p>When the application requests navigation to the route “product”, the router looks in the routes array and activates the instance of the component associated with the route “product”, which is ProductComponent. The browser address location &amp; history is also updated to /product</p><blockquote><strong><em>Routerlink and href</em></strong></blockquote><blockquote><strong>Href</strong> is the core feature provided by Html for navigating through pages which reloads the page on click.</blockquote><blockquote><strong>RouterLink</strong> is feature provided by angular to navigate to different components without reloading the page.</blockquote><blockquote>The major difference between the two is that href kills the state of the current page where routerLink doesn’t lose the state of the page.</blockquote><blockquote><strong>example;</strong><br>RouterLink retains its value after navigation if the page has an input text box. RouterLink can be considered as custom attribute of href in angular by overriding some properties like Page reload.</blockquote><h3>Conclusion</h3><p>In this article, we learned to what is angular router is and learned how to use it.Thank you. See you in the next article…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d886d9f223b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Directives In Angular]]></title>
            <link>https://enessyilmaz.medium.com/directives-in-angular-f7c9abe4000c?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7c9abe4000c</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[directives]]></category>
            <category><![CDATA[ngfor]]></category>
            <category><![CDATA[ngif]]></category>
            <category><![CDATA[ngswitch]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sun, 30 Oct 2022 19:05:20 GMT</pubDate>
            <atom:updated>2022-10-30T19:05:20.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkxFPQzLylMMCjgo5lxQMA.jpeg" /></figure><ol><li><strong>What is Directive?</strong></li></ol><p>Directive means Guidance, Instruction, Directive, Instruction. Angular directives are used to manipulate DOM objects. By using Angular Directives, we can change the appearance, behavior or layout of a DOM object. It also helps us extend the HTML.</p><p>Directives are java script classes created with the help of @Directive decoratore within the Angular project.</p><p>Directives can be examined under 3 headings.</p><p>These;</p><ul><li>Component Directives</li><li>Structural Directives</li><li>Attribute Directives</li></ul><p><strong>2.)Component Directives</strong></p><p>Angular Components are specialized directives. We can also say that Directives are templated ones. Component Directives form the main class. It directs how the Component should be initialized and processed at runtime and how it should be used.<br>The component directive is used to specify HTML templates. It has the structure design and working order of how the component should be rendered, instantiated and used at runtime.</p><p><strong>Explain component directives;</strong></p><p><strong><em>Example-page.component.css</em></strong><em>:</em> Contains all CSS styles for the component.<br><strong><em>Example-page.component.html: C</em></strong>ontains all the HTML code used by the component to display itself.<br><strong><em>Example-page.component.ts: </em></strong>Contains all the code that the component uses to control its behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*qFn4INgVTlOEZ8HrIVxcHg.png" /></figure><p><strong>3.)Structural Directive</strong></p><p>These directives usually shape the structure of the DOM by adding, removing or manipulating elements. Structure Directives are used to manipulate and change the structure of the DOM object. They start with the “*” sign.</p><p>The most widely used structural directives are NgIf, NgFor and NgSwitch directives.</p><p>3.1.)<strong>NgIf</strong></p><p>It allows adding and deleting DOM elements. NgIf is the simplest and easiest to understand structural directive. NgIf takes a boolean expression and shows or destroys the entire DOM element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*ZhWiq6R9bLMxe0QXRQyPSw.png" /></figure><p>NgIf directive becomes property binding when you use it on <em>&lt;ng-template&gt;.</em></p><pre>&lt;ng-template <strong>[ngIf]</strong>=&quot;emp&quot;&gt;<br>  &lt;div class=&quot;name&quot;&gt;{{emp.name}}&lt;/div&gt;<br>&lt;/ng-template&gt;</pre><p>3.2.)<strong>NgFor</strong></p><p>In Angular we use *ngFor to show our existing list in our HTML page. When the list (array) we use changes (for example, when the last version is reloaded from the service); All DOM created for list display is updated again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*NhaGRUqwWiw-ex91tKyvnQ.png" /></figure><p>It is like a loop. You can use an Array to iterate values. In addition, ngfor also becomes property binding when you use it on <em>&lt;ng-template&gt;.</em></p><pre>&lt;div <strong>*ngFor</strong>=&quot;let emp of employees; let i=index; trackBy: trackById&quot; &gt;<br>  ({{i}}) {{emp.name}}<br>&lt;/div&gt;<br>&lt;ng-template <strong>ngFor</strong> let-hero <strong>[ngForOf]</strong>=&quot;heroes&quot; let-i=&quot;index&quot; let-odd=&quot;odd&quot; <strong>[ngForTrackBy]</strong>=&quot;trackById&quot;&gt;<br>  &lt;div [class.odd]=&quot;odd&quot;&gt;({{i}}) {{hero.name}}&lt;/div&gt;<br>&lt;/ng-template&gt;</pre><p>3.3.)<strong>NgSwitch</strong></p><p>It serves to hide and show html elements attached to an expression. When the matching value is provided with the ng-switch-when command, the other sibling when elements will be deleted and the matching element will be displayed. You can show the default partition with ng-switch-default. Again, when any ng-switch-when part is matched, the default expression will be deleted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*HkvA4oshErx66gHrMjXjHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*_kZKcGuO_PCBYysNguo6Kw.png" /></figure><p><strong>4.)Attribute Directives</strong></p><p>Attribute directives are used to modify or modify the appearance, behavior, properties, attributes, and components of HTML elements. Angular’s most commonly used built-in attribute directives are NgClass , NgModel and NgStyle.</p><p><strong>4.1.)NgClass</strong></p><p>The ngClass directive is an expression that represents all classes to be dynamically added. Allows you to set an HTML element CSS classes in data binding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*cq0FbboP0T9naVGdLnHZrw.png" /></figure><p><strong>4.2.)NgModel</strong></p><p>You create ngModelController by using directive on input, select, textarea (or custom form control). This allows you to <strong>bind</strong> the values of these elements to other elements. The elements you can use are listed below.<br>input,text,checkbox,radio,number,email,url,date,datetime-local,time,month,week,select,textarea</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*sQJ7y7ZWpXwdr8plXvRNrA.png" /></figure><p><strong>4.3.)NgStyle</strong></p><p>The ngStyle attribute is used to change or style the multiple properties of Angular. You can change the value, color, and size etc. of the elements.</p><p>It’s a built-in directive that lets you set the style properties of a particular DOM element. Key is a style name and value is an expression to evaluate. The resulting non-null value, expressed in the given unit, is assigned to the given style property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*iGwlyHQeO_g-kcOw8mavuA.png" /></figure><p><strong>5.)Creating a Custom Directive</strong></p><p>While developing enterprise segment projects, we may have very different needs. Such projects are developed in teams by developing many components and features. The more we use code blocks that do repetitive and similar tasks in our projects under dynamic classes, the faster we develop code that can easily meet changing needs according to project development processes. From the first lesson, I repeat that Angular is a framework open to code development in this structure and architecture. Directives are among the components that meet these needs of us, that we can customize according to the project needs and use them wherever we want within the project. Now, how we create a custom directive with Angular CLI and include it in the project, I will explain under this title.</p><blockquote>Example</blockquote><p>ng generate directive directives/color</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*2lAIHpoAcKst6vCl2ss2vw.jpeg" /></figure><p>The directive we have created is automatically imported into the app.module.ts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hbr_uBrShuPkpiB81b9ZeQ.jpeg" /></figure><p>You can apply any customization styles you want through this directive.</p><p>end of the article. Thank you. See you in the next post…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7c9abe4000c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure Module In Angular]]></title>
            <link>https://enessyilmaz.medium.com/structure-module-in-angular-ff27f5c2f337?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff27f5c2f337</guid>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[provider]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[create-module-in-angular]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 14:24:32 GMT</pubDate>
            <atom:updated>2022-10-23T14:24:32.408Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Structure Module In Angular</strong></p><ol><li><strong>What is Module?</strong></li></ol><p>Module in Angular refers to <strong>a </strong>place where you can group the components, directives, pipes, and services, which are related to the application. In case you are developing a website, the header, footer, left, center and the right section become part of a module. To define module, we can use the NgModule.</p><p>2. <strong>App Module</strong></p><p>Everything in Angular is organized in modules. Even if you don’t know, when you create a new project via CLI, angular-cli creates the “App.module” class for you. This module is the root module of the application and is absolutely necessary for it to run. This class specifies which components and modules will be used in the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*AINvjqoMQ8oMQXDnCELdFQ.png" /><figcaption>This is how the app module looks like</figcaption></figure><p>3. <strong>A Basic Use of Modules</strong></p><p>3.1 @<strong>NgModule</strong></p><p>Angular Module is actually a javascript class and to define it, the @NgModule operator must be used so that Angular can recognize this class as a module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*AINvjqoMQ8oMQXDnCELdFQ.png" /></figure><p>3.1.1 <strong>Bootstrap</strong></p><p>To bootstrap our module based application, we need to inform Angular which one is our root module to perform the compilation in the browser.</p><p>The root component of the application is defined here. We only use this property inside App Module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*VvYBUlXq6mip-dZEdPdusw.png" /></figure><p>3.1.2 <strong>Exports</strong></p><p>We define the components, directives, pipes we want to use. In this way, we can access these components from anywhere we want to use the module. Otherwise, these components remain inside the module and cannot be accessed from the outside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*zyrlq2oc3TwRs3M7RTnAfg.png" /></figure><p>3.1.3 <strong>Declarations</strong></p><p>Within the Declarations array, we define all the components, directives and pipes declared and used within this module. When you want to use it within the application without adding components, directives or pipes to this array, you will get an error in the runtime by Angular. Also, a component can only be declared in a module. To use that component in more than one module, you need to import the module you define the component in the modules you want to use.</p><p>3.1.4 <strong>Imports</strong></p><p>You can add as many submodules as you want to the module. These modules can be angular modules as well as modules that you write custom. Angular is built on a modular structure.</p><p>Angular already includes many features.<br>For example;<br>For the Http Clients that you will use in your projects, it will be sufficient to import the Http Client Module.</p><p>3.1.5 <strong>Providers</strong></p><p>A provider is an object declared to Angular so that your components, directives, and other classes instantiated by Angular can be injected into its constructor.</p><p>4. <strong>Create New Module</strong></p><p>We can use “<strong>ng g module module_name</strong>” command to create custom module via Angular CLI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUnXOU9UmAxbOVaFG3pOYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_vu_STHTVvPTeIa2-Kjrw.png" /></figure><p>After running this command from terminal, Angular CLI creates new_module.module.ts file in new_module folder under project’s directory structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*sikUPPtG3rIpMhEqSpmoNw.png" /></figure><p>In this story we created module with Angular CLI</p><p>If you haven’t read my previous article on Angular Component structure, I recommend you to read it in terms of topic integrity.</p><p>See you in the next article…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff27f5c2f337" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Injection]]></title>
            <link>https://enessyilmaz.medium.com/code-injection-f22a53d5e7f0?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f22a53d5e7f0</guid>
            <category><![CDATA[code-injection]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[ldap]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Sat, 22 Oct 2022 16:43:52 GMT</pubDate>
            <atom:updated>2022-10-22T16:43:52.165Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><strong>What is Code Injection?</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mzpShrRLLzDUFW9M7fLEYQ.png" /></figure><p>Exploitation of computer error resulting from processing invalid data. Injection is used by an attacker to inject code into a vulnerable computer program and change the course of execution.</p><p>Code injection refers to attacks that involve injecting malicious code into an application. The application then interprets or executes code that affects the application’s performance and functionality.</p><p>Code injection attacks often take advantage of existing data vulnerabilities, such as insecure processing of data from untrusted sources.</p><p>2.<strong>How Code Injection Attacks Work?</strong></p><p>Code Injection, also known as Remote Code Execution or Code Evaluation, involves replacing an executable or script that contains malicious code. Hackers first probe the application for attack surfaces that can accept untrusted data and use it while executing program code. These include direct input such as file uploads, form fields, or other data sources such as cookies and query string parameters.</p><p>A successful exploit gives attackers access to the application’s server-side interpreter. Attackers can use system calls to run commands on the server and further penetrate for deeper exploitation.</p><p>3.<strong>Types of Code Injection Attacks</strong></p><p>3.1.<em> XSS Attack</em></p><p>3.2. <em>LDAP Injection</em></p><p>3.3. <em>SQL Injection</em></p><p>3.4. <em>Command Injection</em></p><p>3.1. <strong>XSS (Cross-Site Scripting)</strong> <strong>Attack</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*DUsKjekqskZH9Y1Q0XRzuw.jpeg" /></figure><p>3.1.1. <strong>What is XSS?</strong></p><p>A cross-site scripting attack (XSS) occurs when a hacker injects malicious code, usually in the form of client-side scripting, into the content of a web page that is seen as benign and trustworthy. Malicious scripting is usually written in client-side programming languages, which are JavaScript and HTML.</p><p>In general, web applications prone to XSS attacks do not validate or encode users’ input. A cyber criminal could exploit this flaw and send a dangerous script to an unsuspecting end user. Unfortunately, the user’s browser treats the script as if it comes from a trusted source and executes it; this potentially harms the unsuspecting user.</p><p>3.1.2. <strong>How Does an XSS Attack Work?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*sTILLGtopCaoLey87ibEvQ.jpeg" /></figure><ul><li>Cyber criminals discover that a web page that accepts users’ input is vulnerable to XSS attacks. It may be accepting users’ input via comment boxes, login forms, or search boxes.</li><li>Attackers create a malicious script (payload) and send it to an unsuspecting user. It can attach the payload to a phishing link and persuade the targeted person to click it</li><li>When the targeted person clicks on the malicious link, they are taken to the vulnerable web page they trusted until now.</li><li>Payload is injected into the vulnerable web page and the targeted person’s web browser treats it as legitimate source code.</li><li>When the unsuspecting user enters some entries and submits them, the payload is carried out according to the instructions of the cyber criminals.</li></ul><p>3.1.3. <strong>XSS Attack Types</strong></p><p>There are three main attack strategies for XSS. These are DOM XSS, reflected XSS, and stored XSS.</p><p>3.1.3.1. <strong>DOM XSS</strong></p><p>In a DOM-based XSS attack strategy, the hacker injects payload by changing the document object model (DOM) in the victim’s browser, where the original client script is running. The page doesn’t change, but the client-side code found on the page works with malicious code changes.</p><p>3.1.3.2.<strong> Reflected XSS</strong></p><p>In a reflected XSS cyber attack, also known as non-persistent XSS, hackers inject malicious script directly into an HTTP request. It then mirrors it to the user’s browser where it was executed from the web server. The hacker often sends the targeted people customized links that bring them to a vulnerable page.</p><p>Reflected XSS attacks are not permanent. When a user clicks on a malicious link, is tricked into submitting a specially crafted form or browsing a malicious site, the injected code goes to the vulnerable website. The web server, in turn, returns or mirrors the injected script to the user’s browser. This deception can be in an error message, search result, or any other type of response that includes data sent to the server as part of the request. The browser executes the code as it assumes the response comes from a “trusted” server that the user is already interacting with.</p><p>3.1.3.3 <strong>Stored XSS</strong></p><p>Attacks occur when hackers store their payloads on a compromised server. It is a generally damaging XSS attack method. The attacker uses this approach to inject their payload into the target application. If the application does not have login validation, the malicious code is permanently stored or persisted by the application in a location such as a database. In practice, this allows an attacker to insert a malicious script into user input fields, such as comment sections on a blog or forum post.</p><p>The payload of the attacker is presented to the user’s browser when they open the infected page, in the same way that a legitimate comment would appear in their browser. The targeted people accidentally execute the malicious script when they view the page in their browser.</p><p>3.1.4<strong> Common Cross-Site Scripting Vulnerability Vectors</strong></p><ul><li><strong>script tags</strong></li><li><strong>i-frame tags</strong></li><li><strong>image attributes</strong></li><li><strong>input tags</strong></li><li><strong>link tags</strong></li><li><strong>the background attribute of table tags and &lt;td&gt; tags</strong></li><li><strong>div tags</strong></li><li><strong>object tags</strong></li></ul><p>3.1.5 <strong>How to prevent XSS attacks?</strong></p><ul><li><strong>Filter input on arrival</strong></li></ul><p>At the point where user input is received, filter as strictly as possible based on what is expected or valid input.</p><ul><li><strong>Encode data on output</strong></li></ul><p>At the point where user-controllable data is output in HTTP responses, encode the output to prevent it from being interpreted as active content. Depending on the output context, this might require applying combinations of HTML, URL, JavaScript, and CSS encoding.</p><ul><li><strong>Use appropriate response headers</strong></li></ul><p>To prevent XSS in HTTP responses that aren’t intended to contain any HTML or JavaScript, you can use the Content-Type and X-Content-Type-Options headers to ensure that browsers interpret the responses in the way you intend.</p><ul><li><strong>Content Security Policy</strong></li></ul><p>As a last line of defense, you can use Content Security Policy (CSP) to reduce the severity of any XSS vulnerabilities that still occur.</p><p>3.2 <strong>LDAP ( Lightweight Directory Access Protocol) Injection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*9ZGjw3CxKooDZSpITexhdQ.jpeg" /></figure><p>3.2.1 <strong>What is LDAP injection?</strong></p><p>LDAP injection is a vulnerability in which queries are constructed from un trusted input without prior validation or sanitization. LDAP uses queries constructed from predicates that involve the use of special characters (e.g., brackets, asterisks, ampersands, or quotes). Meta characters such as these control the meaning of the query; thereby, affecting the type and number of objects retrieved from the underlying directory. If an attacker can submit input containing these control characters, they can alter the query and change the intended behavior.</p><p>3.2.2 <strong>How do LDAP injections work?</strong></p><p>An LDAP injection attack exploits security loopholes caused by un sanitized user input data. In other words, LDAP injections create malformed queries to gain access in order to potentially change data in a directory. LDAP queries contain special characters such as asterisks, brackets, ampersands and quotes. These characters control the meaning of LDAP queries and dictate the type and number of objects returned by a query. Attackers can alter the query and its intended behavior by modifying these control characters within the query.</p><p>For example, in a login query that uses LDAP, an attacker can enter the username plus several meta characters that manipulate the protocol into ignoring the password field.</p><p>Using LDAP injection, an attacker can enter the directory to gain access to unauthorized information or modify LDAP statements and content inside the LDAP tree. They can also exploit web applications that create LDAP statements based on user input. Tools that use LDAP include Red Hat Directory Server and Microsoft Active Directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VFrqoI8HI_9iEFXt9w0ywQ.jpeg" /></figure><p>3.2.3 <strong>LDAP Attack Types</strong></p><p>3.2.3.1. <em>Authentication bypass</em></p><p>3.2.3.2. <em>Elevation of access privileges</em></p><p>3.2.3.3. <em>Resource disclosure</em></p><p>3.2.3.4. <em>Blind attack</em></p><p>3.2.3.1 <strong>Authentication bypass</strong></p><p>Authentication bypass on a login page, there are generally two text box fields for a username and password. LDAP normally validates username and password pairs using LDAP filters. To bypass the password validation portion of the process, the attacker can enter a meta character — specifically an ampersand.</p><p>3.2.3.2. <strong>Elevation of access privileges</strong></p><p>Elevation of access privileges an attacker uses un sanitized user input to gain unauthorized access to information that is reserved for privileged users in the system.</p><p>3.2.3.3. <strong>Resource disclosure</strong></p><p>Resource disclosure the attacker takes advantage of the fact that some objects in the LDAP system are searchable by any user. The attacker searches for a certain object, and under normal circumstances, the directory would return all publicly available results. With the insertion of malicious code, the attacker could manipulate this query to return <em>all </em>objects of that type, both private and public.</p><p>3.2.3.4. <strong>Blind attack</strong></p><p>Blind attack Blind LDAP injections work on binary They elicit a true or false response from the server, enabling the attacker to gain information about the contents of the directory. These attacks are slower to implement but are simpler because they just rely on a true or false response. Attackers can test if a certain resource exists or is available — a user object or a printer, for example. A skilled hacker could use this technique to return more complex values using a mechanism called Booleanization. For example, a hacker could query each value in a string as a true or false question, until the entire string is revealed.</p><p>3.2.4 <strong>How to prevent LDAP injection attacks?</strong></p><ul><li><strong>Input validation (allow listing)</strong></li></ul><p>Allow listing involves only accepting input that is known to be good; for example, setting an expected length or numeric range for a given input field.</p><ul><li><strong>Escaping all variables</strong></li></ul><p>This tells the computer to ignore the special functions of meta characters — like ampersands — that hackers can use to manipulate LDAP input fields. Some querying frameworks escape automatically when building queries — like LINQ to LDAP, for example.</p><ul><li><strong>Indexing fields that contain sensitive information</strong></li></ul><p>This increases the number of filters an attacker has to bypass or manipulate to access sensitive information.</p><ul><li><strong>Static source code analysis tools</strong></li></ul><p>These enable developers to debug an LDAP application before it is running.</p><ul><li><strong>Dynamic checks</strong></li></ul><p>These enable developers to test and debug an application while it is running.</p><p>3.3 <strong>SQL (Structured Query Language) Injection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*mrHhuruIKhRTFm9FfzFfNQ.jpeg" /></figure><p>3.3.1 <strong>What is SQL Injection?</strong></p><p>SQL injection (SQLi) is a web security vulnerability that allows an attacker to interfere with the queries that an application makes to its database. It generally allows an attacker to view data that they are not normally able to retrieve. This might include data belonging to other users, or any other data that the application itself is able to access. In many cases, an attacker can modify or delete this data, causing persistent changes to the application’s content or behavior.</p><p>In some situations, an attacker can escalate an SQL injection attack to compromise the underlying server or other back-end infrastructure, or perform a denial-of-service attack.</p><p>3.3.2 <strong>How Does a SQL Injection Attack Work?</strong></p><p>A SQL injection attack targets vulnerabilities in dynamic SQL statements. Think of a dynamic SQL statement like a multivariate function in mathematics, of which the parameters are fixed, while the values substituted in the independent variables determine the result.</p><p>Similarly, a dynamic SQL statement also consists of a predetermined set of parameters (such as a web form), of which the complete statement is only generated when a user fills in their inputs. See the following example of a SQL statement of a login form:</p><p><strong>SELECT * FROM users WHERE username = ‘$username’ AND password = bcrypt (‘$password’)</strong></p><pre>&lt;?php<br>$query = &quot;SELECT * FROM users WHERE kullanıcı adı = &#39;&quot; . $_POST[&#39;kullanıcı adı&#39;] . &quot;&#39;&quot;;<br>$sorgu .=&quot; VE şifre = &#39;&quot; . $_POST[&#39;şifre&#39;] . &quot;&#39;&quot;;			 <br>?&gt;</pre><p>After the user enters their username and password, the statement would be completed, after which a query would be sent to the server to retrieve the user’s information from the database.</p><p>When a vulnerability exists in a dynamic SQL statement, the attacker would be able to enter complex scripts into the forms to interfere with the preexisting parameters to alter the meaning of the complete statement.</p><p>3.3.3 <strong>SQL Injection Attack Types</strong></p><p>3.3.3.1. <em>In-band SQLi (Classic SQLi)</em></p><p>3.3.3.2. <em>Inferential SQLi (Blind SQLi)</em></p><p>3.3.3.3.<em> Out-of-band SQLi</em></p><p>3.3.3.1. <strong>In-band SQLi (Classic SQLi)</strong></p><p>In-band SQL Injection is the most common and easy-to-exploit of SQL Injection attacks. In-band SQL Injection occurs when an attacker is able to use the same communication channel to both launch the attack and gather results.</p><p><strong>Error-based SQLi</strong> is an in-band SQL Injection technique that relies on error messages thrown by the database server to obtain information about the structure of the database. In some cases, error-based SQL injection alone is enough for an attacker to enumerate an entire database. While errors are very useful during the development phase of a web application, they should be disabled on a live site, or logged to a file with restricted access instead.</p><p><strong>Union-based SQLi</strong> is an in-band SQL injection technique that leverages the UNION SQL operator to combine the results of two or more SELECT statements into a single result which is then returned as part of the HTTP response.</p><p>3.3.3.2. <strong>Inferential SQLi (Blind SQLi)</strong></p><p>Inferential SQL Injection, unlike in-band SQLi, may take longer for an attacker to exploit, however, it is just as dangerous as any other form of SQL Injection. In an inferential SQLi attack, no data is actually transferred via the web application and the attacker would not be able to see the result of an attack in-band (which is why such attacks are commonly referred to as blind SQL Injection attacks. Instead, an attacker is able to reconstruct the database structure by sending payloads, observing the web application’s response and the resulting behavior of the database server.</p><p><strong>Boolean-based SQL Injection</strong> is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the application to return a different result depending on whether the query returns a TRUE or FALSE result.Depending on the result, the content within the HTTP response will change, or remain the same. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned. This attack is typically slow (especially on large databases) since an attacker would need to enumerate a database, character by character.</p><p><strong>Time-based SQL Injection</strong> is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the database to wait for a specified amount of time (in seconds) before responding. The response time will indicate to the attacker whether the result of the query is TRUE or FALSE.Depending on the result, an HTTP response will be returned with a delay, or returned immediately. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned. This attack is typically slow (especially on large databases) since an attacker would need to enumerate a database character by character.</p><p>3.3.3.3.<em> </em><strong>Out-of-band SQLi</strong></p><p>Out-of-band SQL Injection is not very common, mostly because it depends on features being enabled on the database server being used by the web application. Out-of-band SQL Injection occurs when an attacker is unable to use the same channel to launch the attack and gather results.</p><p>Out-of-band techniques, offer an attacker an alternative to inferential time-based techniques, especially if the server responses are not very stable (making an inferential time-based attack unreliable).</p><p>Out-of-band SQLi techniques would rely on the database server’s ability to make DNS or HTTP requests to deliver data to an attacker. Such is the case with Microsoft SQL Server’s xp_dirtree command, which can be used to make DNS requests to a server an attacker controls; as well as Oracle Database’s UTL_HTTP package, which can be used to send HTTP requests from SQL and PL/SQL to a server an attacker controls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*wCegWJko9YGTz8vhMtLuuA.jpeg" /></figure><p>3.3.4 <strong>How to Prevent a SQL Injection Attack?</strong></p><p>Preventing or mitigating SQL injection attacks is a lot about ensuring that none of the fields are vulnerable to invalid inputs and application execution. yours is manually impossible to actually to check every page and every application on the website, especially when updates are frequent and user-friendliness is the top priority.Nonetheless, security analysts and seasoned developers recommend a number of the subsequent points guarantee your database square measure well protected inside the confinement of the server.</p><p><strong>1)Continuous Scanning and Penetration Testing</strong></p><p>The automated web application scanner<strong> </strong>has been the best choice to point out vulnerabilities within the web applications for quite some time now. Now, with SQL injections getting smarter in exploiting logical flaws, website security professionals should explore manual testing with the help of a security vendor.</p><p>They can authenticate user inputs against a set of rules for syntax, type, and length. It helps to audit application vulnerabilities discreetly so that you can patch the code before hackers exploit it to their advantage.</p><p><strong>2)Restrict Privileges</strong></p><p>It is more of a database management function, but enforcing specific privileges to specific accounts helps prevent blind SQL injection attacks. Begin with no privileges account and move on to ‘read-only’, ‘edit’, ‘delete’ and similar privilege levels.</p><p>Minimizing privileges to the application will ensure that the attacker, who gets into the database through the application, cannot make unauthorized use of specific data.</p><p><strong>3)Use Query Parameters</strong></p><p>Dynamic queries create a lot of troubles for security professionals. They have to deal with variable vulnerabilities in each application, which only gets graver with updates and changes. It is recommended that you prepare parameterized queries.</p><p>These queries are simple, easy to write, and only pass when each parameter in SQL code is clearly defined. This way, your info is supplied with weapons to differentiate between code and information inputs.</p><p><strong>4)Instant Protection</strong></p><p>A majority of organizations fail the problems like outdated code, scarcity of resources to test and make changes, no knowledge of application security, and frequent updates in the application. For these, web application protection is the best solution.</p><p>A managed web application firewall can be deployed for immediate mitigation of such attacks. It contains custom policies to block any suspicious input and deny information breach instantly. This way, you do not have to manually look for loopholes and mend problems afterward.</p><p>3.4. <strong>Command Injection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEdhnynny7HIWsjym26RaQ.jpeg" /></figure><p>3.4.1. <strong>What is Command Injection?</strong></p><p>Accomplished by sending incidental and corrupted commands towards the host server’s OS, this attack aspires to gain admin-like control of the targeted site or app and its associated elements. Depending upon the intensity, the OWASP command injection attack can influence other application components such as hosting infrastructure, trust between the client and the server, and overall application performance.</p><p>3.4.2 <strong>How Does Command Injection Work?</strong></p><ul><li>Its success is more probably when risky elements like HTTP header fields, form components, and session cookies are linked with the user-delivered data</li><li>For complete execution, attackers take the help of any third-party vulnerable resource/application</li><li>The lack of valid inputs supports the existence of this attack</li><li>This attack doesn’t necessitate the insertion of code. Instead, it deals with expanding the default app capabilities to deploy command injection payloads successfully on the tempered system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-z6aW1LTTW32wU0FDGxzbQ.jpeg" /></figure><p><strong>Examples</strong></p><ol><li>Let’s say, there is a program that allows users to view file contents but the commands including “;rm -rf /” work for it. An intruder can erase data from the current partition’s contents easily through it.</li><li>Let’s consider a command injection PHP scenario now. If a corrupted HTTP GET request is accepted in your system, it can manipulate your files, putting them at risk for sure. See this:</li></ol><p>http ://127.0.0.1/delete.php?filename=inject_demo.txt;id</p><p>The above command will delete a file named “inject_demo.txt” from your website/app and can be run by anyone.</p><p>3.4.3. <strong>Command</strong> <strong>Injection Attack Types</strong></p><p>3.4.3.1. <em>Random command injection</em></p><p>3.4.3.2. <em>Arbitrary file uploading or usage</em></p><p>3.4.3.3. <em>Vulnerable serialization</em></p><p>3.4.3.4. <em>Server-side Template</em><strong> </strong><em>Injection</em></p><p>3..4.3.5. <em>XML External Entity Injection or XXE</em></p><p>3.4.3.1. <strong>Random command injection</strong></p><p>There are various applications that allow clients to execute random commands. These apps are more prone to injection through commands as commands can be sent automatically to the host.</p><p>3.4.3.2. <strong>Arbitrary file uploading or usage</strong></p><p>Applications permitting clients to upload any random file is problematic because attacks can make use of it to carry out command injection attacks. It’s easy to introduce any malicious command using an arbitrary file.</p><p>Mostly, threat actors place such files in the web root and execute the attack.</p><p>3.4.3.3. <strong>Vulnerable serialization</strong></p><p>When server-side deserialization is completed without adequate user input verification, it’s easy to perform this attack.</p><p>3.4.3.4. <strong>Server-side Template Injection</strong></p><p>It permits a website to create dynamic HTML responses, which is an opportunity for attackers. The presence of such HTML responses makes malicious command insertion on the server-side templates possible.</p><p>3.4.3.5. <strong>XML External Entity Injection or XXE</strong></p><p>Applications featuring an ill-configured XML parser won’t be able to parse the user-controlled XML inputs properly and create a vulnerability space for the command injection. Taking the advantage, attackers can introduce an exploited command in the XML parser resulting in <strong>DDoS</strong> and <strong>SSRF</strong> attacks. Additionally, it will lead to data theft.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*NkeYJg1NW9X_nYYZW3BZ8Q.jpeg" /></figure><p>3.4.4. <strong>How to prevent command injection?</strong></p><p>Depending on the affected application and the data it inherits, the result of a command injection can be very harmful. Therefore, along with early detection, some of the most appropriate command injection prevention tactics should be aware of</p><p><strong>Safeguard ‘exec’ First</strong></p><p>Try to avoid “exec” out to the OS as much as possible as it will keep the risks on the lower side. Ensure that most of the application work is done inside the application.</p><p><strong>Strict Validation Checks</strong></p><p>Make sure that the un trusted inputs are validated from beginning to end. Introducing non-validated inputs encourages vulnerability in the application. Along with the validation, one must also ensure that the inputs meet the application’s expectations.</p><p>One of the most widely acceptable validation processes is “whitelist validation” which involves accepting only application-compatible input and rejecting others. While performing validation, input components like character set, date bounds, minimum &amp; maximum length, date &amp; numeric bounds, Regular Expression Pattern match value, and many more.</p><p><strong>Neutralize meta-characters</strong></p><p>There are many meta-characters that hold some importance in the OS command line. So, by neutralizing them, you can prevent their misuse by hackers. It should be done in Windows, Linux, and Unix OS.</p><p>Window users can make this happen by preceding every character with a ‘^’. To neutralize its special meaning, ( ) &lt;&gt;&amp; * ‘ | = ? ; [ ] ^ ~ ! . ” % @ / \ : + , ` needs to be done.</p><p>The procedure is used for Linux and Unix OS. In this case, antecedent of the subsequent characters should be done with an ‘\’ and meaning neutralization can be one with { } ( ) &lt;&gt;&amp; * ‘ | = ? ; [ ] $ — # ~ ! . ” % / \ : + , `. In each case, meaning neutralization will be done to the command-line interpreter.</p><p><strong>Give Fewer Privileges</strong></p><p>Implementing least privilege is not direct prevention. But, as it limits the permissions related to the account used for OS command execution, it keeps the risks and incurred harm on the lower side.</p><p><strong>Use Safe APIs</strong></p><p>Command execution should be done with the help of secured APIs. Such APIs reduce the command injection risks as they permit the command execution first as a parameter and then as a command-line arguments array. This way, it warrants extensive command validation and takes the form of a valid program, free from risky elements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f22a53d5e7f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Component Structure in Angular]]></title>
            <link>https://enessyilmaz.medium.com/component-structure-in-angular-1033e88cc8db?source=rss-6e37bee5e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1033e88cc8db</guid>
            <category><![CDATA[create-angular-project]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[structure]]></category>
            <dc:creator><![CDATA[Enes Yilmaz]]></dc:creator>
            <pubDate>Fri, 14 Oct 2022 10:21:53 GMT</pubDate>
            <atom:updated>2022-10-23T14:25:25.226Z</atom:updated>
            <content:encoded><![CDATA[<h3>Structure Component In Angular</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*Sg_Trfzg_JkMVtb1JgbqOQ.jpeg" /></figure><p>In this article, we will examine the Angular Component structure. We will never actually use the codes that we will see a little later, Angular CLI will automatically prepare them for us when setting up a project. But let’s examine our first component to understand the structure a little better.</p><p>let’s build a project first</p><blockquote>ng new ExampleAngularProject</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rt_4rm_Mw5nIUuMQ1Um9-Q.png" /></figure><p>The construction of our first project is being prepared with the code line in the example.</p><p>then the system asks us if there is a routing structure and we say “yes” but we will not use it yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*voYj_pYJ_OPbVitkebfjGA.png" /></figure><p>Then the style selector we should use to style it asks and we choose css for now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQlc41Y45JkuiTJ1AV-0MQ.png" /></figure><p>and the project is being built…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9K_Af1UipB9HgOF-Dj11QQ.png" /></figure><p>The project is built and now we can inspect the component structure.</p><p>We will make almost all the developments related to our project in the SRC folder. Angular created us a main module called <em>(app.module.ts).</em> We will develop our project under this module. All the components we created will be rendered into the <em>&lt;app-root&gt;&lt;/app-root&gt;</em> element in index.html.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*QfNLoqiPpwINuVL6j2DoxQ.png" /></figure><p>Now I will try to explain the structure in detail via the <em>app.component.ts</em> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LeZWPM4nKW1UJRLx1SO_bQ.png" /></figure><blockquote>import { Component } from ‘@angular/core’;</blockquote><p>Decorator the component structure from <a href="http://twitter.com/angular/core">@angular/core</a> .</p><p><strong>Decorator</strong>: It is a Typescript property. Basically, it is a classic javascript function and when we use it with the @ sign, it passes as a decorator and references the function it belongs to.</p><p><strong>Component Function:</strong>The component takes a parameter into the function and we need to give information about the component we will create.</p><pre>import { Component } from &quot;@angular/core&quot;;@Component(<br>@Component(    <br>{}<br>)<br></pre><p><strong>Selector:</strong>It allows us to use our selector component inside html tags. like &lt;div&gt; , &lt;span&gt;</p><pre>import { Component } from &quot;@angular/core&quot;;@Component(<br>@Component(    <br>{<br>        <strong>selector: &quot;app-root&quot;, </strong><br>       <br>    }<br>)<br>export class AppComponent{}</pre><p><strong>Templateurl: </strong>This is the field where I specify which html file our component will render.</p><pre>import { Component } from &quot;@angular/core&quot;;@Component(<br>@Component(   <br> {<br>        selector: &quot;app-root&quot;, <br>        <strong>templateUrl: &quot;app.component.html&quot;</strong><br>    }<br>)<br>export class AppComponent{}</pre><p><strong>StyleUrls: </strong>This is the area where we determine which css file our component will render.</p><pre>import { Component } from &quot;@angular/core&quot;;@Component(<br>@Component(   <br> {<br>        selector: &quot;app-root&quot;, <br>        templateUrl: &quot;app.component.html&quot;,<strong><br>        styleUrls:&quot;app.component.css&quot;<br></strong>  }<br>)<br>export class AppComponent{}</pre><p>We have come to the end of the review of the component structure. In my next article, we will examine the modular structure in angular.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1033e88cc8db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>