How to create a custom dropdown using Angular CDK

Angular CDK is a library from Google that provides a set of tools which helps to simplify the component building process in Angular. It provides utilities for creating floating panels, virtual scrolling, drag-n-drop, accessibility and more. If you are creating a reusable library in Angular then CDK will be of great help.

Creating a custom dropdown with the same behaviors of a native one is a little complex job. Though in outside dropdowns looks simple there is a lot of engineering goes with it, like positioning the dropdown, adjusting it's position and dimensions based on screen real-estate, keyboard accessibility etc. The Angular CDK library has dedicated modules to deal with creating overlays and accessibility. In this article I'm gonna show you how we can build a custom dropdown step by step with the help of CDK.

Continue Reading

Applying Validation in Custom Form Components

Angular platform ships Angular Material library that contains quite a bunch of UI components which helps to develop Single Page Apps easier. The material components are opinionated and they follows Google's Material Spec. Sometimes we've to develop components from scratch either wrapping over the native HTML elements or third party components. For custom components created in such ways, Angular provides support for them to bind data and synchronize the state through interfaces. It also a good idea to encapsulate the validation and displaying error messages work inside the custom component.

In this article, I'll show you how we can leverage the built-in validation and display the error messages inside a custom component.

Continue Reading

Web API Tutorial Part I

We do not use HTTP just for preparing web pages. We all know that HTTP is a very strong platform for constructing APIs that reveal data and services. HTTP is easy to use, agile, and ever-present. Using API we shall easily communicate with variety of other languages with less code.

Most of the platforms in existence today contain a HTTP library. This enables the HTTP services to extend to a wide variety of clients, consisting of traditional desktop applications, mobile devices, and browsers. In this article we are gonna see how to build a simple REST service using ASP.NET Web API and test the methods using PostMan.

Continue Reading

Angular directives for CSS3 Grid

CSS3 provides couple of powerful concepts to create layouts: Grid and Flex. The former uses a top to bottom approach and later uses the reverse. Both these concepts are well supported by browsers except IE11. Though there are advantages in leveraging CSS to accomplish layouts (for example, we can make them responsive through media queries) there are benefits in leveraging a HTML like declarative approach. Angular provides a powerful concept called directives that helps to enhance HTML by adding custom behaviors to it.

In this post, I'm gonna show you how we can create couple of directives that helps to craft layouts using CSS3 grid. As a bonus, I also show you how we can make the layouts responsive. I'm also glad to introduce you the library angular-bone which is a real world implementation of this sample that supports both flex and grid layouts.

Continue Reading

How to create an awesome hybrid mobile app - Part IV

Here comes the fourth and final part of the hybrid mobile series in the hot summer. At the time of writing this from Bangalore (was called as Green City not any more I think) it's quite hot like 40° C. Time to take care of our nature! Anyway, we've come through a long way... let's finish this final part. Our hybrid mobile app "Safe" has grown into a pretty good shape now. So far, the work we've done allows an user to select a photo and persist in a secured way by AES 256 encryption. We also completed the work to edit an already persisted photo or wipe it out permanently.

Safe Login Pages

Fig 1. Safe Login Pages

Encrypting and persisting the photos is not enough to keep them safe! We've to protect the access to the app through a login mechanism and that's what we are gonna build in this part. We'll also see how to build the settings and info pages and last but not least I'll introduce you to Jasmine and show how she'll help us to write some good unit tests. So folks, ARE YOU READY?

Continue Reading

How to create an awesome hybrid mobile app using Cordova - Part III

Welcome to the third part of creating an awesome hybrid mobile app series. In the last two parts we've set-up the development environment, created grunt tasks to support development and deployment and also we've developed two important pages of the app: list page and the single photo view page. If you remember since we didn't complete the add functionality we've to hard-coded some data in the router to complete these two pages. In this part we are going to complete the complex page of the app - the add/edit page.

Safe - Add/Edit page

Fig 1. Safe - Add/Edit page

Once you completed this part you can successfully upload your photos from the photo library and keep them safe. In the next and the final part we are going to work on the login functionality. Please share your questions and thoughts through comments.

Continue Reading

How to create an awesome hybrid mobile app using Cordova - Part II

Hello friends, finally.. I'm back to share the second part of creating the hybrid mobile app. Apologies for taking too long! From my experience it looks like writing is harder than coding! Thanks for all the readers who shared their valuable comments. In the previous part, we worked mainly on setting up the development environment and also we tried to create a "Walking Skeleton" by wiring up the crucial components. Sadly, we haven't seen any code specific to the mobile app yet. I bet this part is gonna throw away that. We are going to do some really cool stuff here! We are going to build two important pages: "list page" and "single photo view page". We'll also see how to deploy the app in an iPhone and Android. At the end of this part, you'll have a simple and nice app (with some features) smiling right at you from your mobile.

Safe running in iPhone and Android Moto E devices

Fig 1. Safe running in iPhone and Android Moto E devices

Actually, I tried to complete most of the core functionalities of the app in this part including the add/edit feature (which is kind of little complicated) but that ballooned the size of the article to a mini-book. Well, nowadays most people don't like to spend more time on reading lengthy articles and so I moved the add/edit feature to a separate part. You would be expecting two more parts from me. In the upcoming one, we'll see how to build the add/edit page and in the last part we'll see how to implement the login/registration feature and the related functionalities of it.

Continue Reading

How to create an awesome hybrid mobile app using Cordova - Part I

It's been little over an year I've published anything in my blog. Every time I inspect my Google analytics page I sense the traffic is getting down 😣. I've been patience for all this time working now and then with sheer confidence that I could complete this taunting work. People who have been following my recent blog posts know that it's no longer a typical blog where enthusiastic developers write about creating todo app in some got-popular-lately technology or comparing two frameworks and describing their pros and cons in a table. I encourage learning by building something for real. I'm driving my website in that path. It's a place where I can share the experience about something that I built lately. It's easy said but it takes a lot of time and effort to build something useful and share with others. In all those months passed I was working in this hybrid mobile app so called "Safe" that helps to store photos safely. The app runs successfully in both iOS and Android platforms. I would like to share the experience I had in creating this app through this series of blog posts. I strongly believe that it'll help a lot of people to build their own *dream* app 🌝.

Safe - hybrid mobile app

Fig 1. Safe - hybrid mobile app

The idea (💡) of building a mobile app came to me three years back when I was facing difficulty in keeping sensitive information like passwords, credit-cards and photos. I own an iPhone 3GS device and was thinking that developing an app would help me to keep my secrets safely and easily accessible from anywhere. There are already a lot of apps out there that solves this problem but I want to build one myself so I can learn something new. I ended up finally developing an app that could store only the photos but not the textual information. The good news is the app runs fine in both iOS and Android devices.

Continue Reading