Unsubscribing an observable in Angular 6

Many people have questions regarding observable subscriptions (or executions) :- What is meant by unsubscribing an observable execution? Do we need to unsubscribe? When and how should we unsubscribe? etc. Its always the what, why, when and how that we need to know and that describes everything. So I will follow the obvious sequence to answer these questions.

Angular 6 Template-driven form with multiple components

In this post I am gonna show you how to create an Angular 6 Template-driven form that spans across multiple components.

Passing value from one observable to another in RxJS

While creating a web application using RxJS such as an Angular 2/4/6 application, you might come across situations in which you need to pass value from one observable to another dependent observable and then utilize the final result into the application. For example you may want to send an ajax request based on the result of another ajax request and then show the result of second request on the UI.

Providing mock services in angular 2/4/6 unit test

When you are writing unit tests for a component or a service that depends on another service then it is better to provide test alternatives for that service instead of the real service, as the real service might in turn depend on some other services or it might try to send some request to the server etc. Moreover our purpose is to test the component or service under consideration not its dependencies.

Acquire services dynamically (or generically) in Angular 2+

Acquiring a service dynamically through injector in Angular 2(+) is pretty straightforward. All you have to do is inject the Injector itself into the component's constructor instead of the services and then get the service instance by using the injector.get() method.

Adding CSS style sheet to angular CLI project

Here I am gonna demonstrate you how to add CSS style sheets to angular CLI project. Let's say we need to add bootstrap.css into our angular cli project, so here is how you can do that in different ways.

There are two ways to add bootstrap styling to angular 4 project one is by installing the bootstrap node package and the other is by using the CDN (Content Delivery Network) for providing bootstrap files. Both of these methods are illustrated below.

Deploying angular 4 application in IIS

There are 2 ways for deploying an angular app in IIS, one is as a separate web application and the other as a sub application to an existing web site(Default Web Site in this tutorial). Both of these methods are illustrated below one by one:-

Using async - await in different scenarios

While using asynchronous programming you might come across different scenarios. A few of those are explained here briefly.

async & await in C#

"async" and "await" are language level constructs in C# used for asynchronous programming. Keywords "async" and "await" and types Task and Task<T> together constitute the task based async model in .NET.

as and is in C#

These keywords are used in scenarios where there is compatible type conversion or we need to check for type compatibility.

Collate in SQL Server

Collate specifies the set of rules that are used during various comparisons, sorting etc. For example it specifies whether the comparisons should be case sensitive or not etc.

KoGrid with server side paging, sorting and filtering

Here is the code for implementing server side paging, sorting and filtering in koGrid (a.k.a. knockout grid). To see how to implement lazy loading in koGrid follow the link.

Committing against a workitem in VSTS

The detailed steps for creating a workitem in VSTS and committing against it in Git version control system are provided below :-

Sorting in Angular js controller (along with paging)

Considering the problem of sorting only a handful of items that are on the current page, I guess sorting using the "orderBy" filter inside ng-repeat tag is not a good idea. So the solution is to apply sorting in AngularJS controller and here is how you can do that.

Sorting in Angular JS along with paging - (in View)

Below is the code for applying sorting in Angular js table along with paging applied. In this code the sorting is done on the view only i.e. sorting is done using attributes in the ng-repeat tag itself.

Accessing properties and methods of an object in C# using Reflection

There might be situations where you want to loop through the members of an object or you want to create some generic means to access the members of one or more classes, so here is how you can access the members of an object in C# in a generic manner.

Drag and Drop using jquery ui


Here is a small sample that demonstrates the use of jQuery UI's drag and drop functionality

Calling a Oracle S.P. that is returning REFCURSOR through Entity Framework

Here are the steps for how to call Oracle S.P. that is returning REFCURSOR through Entity Framework :-

Uploading file using ajax and wcf rest

The simple implementation to upload a file using ajax to wcf rest service is explained as:-

Create deep copy of recordset (C#)

Here is the function to create deep copy of recordset in C# (for VB code click here) :-

Create deep copy of recordset (VB.NET)

Here is the function to create deep copy of a recordset in VB.NET (for C# code click here) :-