Posts

Showing posts from November 15, 2020

Eager Loading, Lazy Loading Strategies In Angular

Image
Angular has provided 3 types of module loading strategies. Every module loading strategy has its own way of implementation. In this post, we will know about what is the basic definition and benefits of every loading strategy.  Why we use loading strategy ? It is necessary to load the feature modules or components that are required to render an application. Based on our requirements, We need to know which loading strategies will suitable to our application. 1. Eager Loading  2. Lazy Loading 3. Pre Loading Eager Loading : It is the default loading strategy to load the components in angular application. It is useful in small size applications.  In Eager Loading all the components will be loaded before the application starts . It makes subsequent request to the application will be very faster. In Eager loading, all the components will import in app.module.ts. Lazy Loading : It loads only the required feature modules to render the page in application. In Lazy loading, feature module will l

Export to Excel in Angular 6 | 7 | 8 | 9 | 10

Image
How to export the data in excel in Angular In Angular, we have different types libraries to export the data into excel file in different formats like (.xlsx, .xls, .csv). No need to communicate the server to export the data in excel file. Here we need to know about two famous angular libraries to export the data in excel file.  1. xlsx is a library to generate excel file in different formats with graphical design. Click here xslx ✋  to know more information about this library. 2. file-saver is a library to save the files in client side.  Click here file-saver ✋  to know more information about this library.  The main advantage of using this approach is, it will improve the performance to your application. In this post, We can see how to implement the export to excel functionality using xlsx library in Angular. Step 1 :   To create new application using angular cli, open Visual Studio code tool and open the terminal (ctrl + shift + ` ).  CLI co

Angular CLI Commands - Cheat Sheet

Image
Angular CLI (Command Line Interface) is one of the powerful tool that allows you to perform a lot of actions in an Angular project by using simple commands. We can use the CLI tool directly in a command shell, or indirectly through an interactive UI such as Angular Console.  The Best Advantage is that, can avoid manual process to create lot of stuff like create components, directives, feature modules, services... etc.  It automatically recompiles the source code files and refreshes the app in the browser.  Let's see, how to install CLI tool and what are those CLI commands. Installing the CLI is very quite easy. All we need to do, is to run the below command in Terminal or Console. It will install the CLI tool globally with respective version. Here we need to know two things before installing the CLI tool. We can install latest version or any version released by angular team based on your project need. Check the Versions list.✋ Angular CLI Setup  1. Globally - To install CLI tool g

How to Convert JSON Object to XML in C#

Image
JSON (Javascript Object Notation) is very popular for web development. It is light weight data-exchange format. Most of the applications are using this format to exchange the data for web applications. Sample JSON array of Objects :  {    "users" : [       { "firstName" : "John" ,  "lastName" : "Peter" },       { "firstName" : "Wills" ,  "lastName" : "Smith" }     ] } To use this format, need to install the Newtonsoft.json package. For more detail and version related information you can find it ✋here . Open the Visual Studio, go to the package manager console and type the below command. Basic Definition of XML (Extensible Markup Language  is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. Sample XML format :  < root >    < user >         < firstName > John </ firstName >         < lastNam

Naming Conventions

Image
Naming Conventions is very important for any application for better readability of  code. What is Naming Convention ?  Naming conventions are general rules applied when creating text scripts for software programming. They have many different purposes, such as adding clarity and uniformity to scripts, readability for third-party applications, and functionality in certain languages and applications. They range from capitalization and punctuation to adding symbols and identifiers to signify certain functions. Advantages of Naming Conventions are : 1. Consistency 2. Better understanding the code 3. Readability 4. Automation Types of Naming Conventions:  1. camelCase : First letter should be lower case. 2. PascalCase :   All words should be upper case. 3. kebab-case : Use dash symbol between word to word with lower case. 4. snake_case : Use underscore symbol between word to word with lower case. How and where these naming conventions will use ? Please check this post Angular Coding Style P

Angular Coding Styles and Standards - PART 1

Image
Coding Styles is very important to every application. It tells how the application is clean and neat.  Every programming language has common coding styles and standards. We must follow the few of the coding styles it will very helpful to application development. Then the code will easier to understand. In this post, listed few of the angular coding styles and standards with small examples. 1. Per file, the code should limit to 400 lines. import  {  Component  }  from   '@angular/core' ; @ Component ({    selector :   'app-root' ,    templateUrl :   './app.component.html' ,    styleUrls :  [ './app.component.scss' ] }) export   class   AppComponent  {    // Per file, the code should limit to 400 lines. } 2.  Per function, the code should limit to 75 lines. public   displayUserInformationToTable ():  void  {   // Per function, the code should limit to 75 lines. } export   function   getUserName ():  void  {   // Per function, the code should limit to 75 l