Month: December 2018

Angular

Using Angular’s Location Service

Location is a service available in Angular 2+ apps that makes it easy to interact with the current URL path. For most navigation needs, the Angular router is the correct solution, but in a few cases the location service is needed to affect the url without involving the router. Plus, the location service can come-in […]

Angular

Getting Started With GraphQL in Angular with Apollo

Apollo is a GraphQL client that makes it very easy to develop GraphQL applications with the likes of React and Angular. All you need to get started is a few dependencies and a client configuration, and you’ll be off to the races running queries and mutations against your GraphQL endpoints. You can refer to our […]

Angular

Reactive Forms in Angular: Listening for Changes

Reactive form instances like FormGroup and FormControl have a valueChages method that returns an observable that emits the latest values. You can therefore subscribe to valueChanges to update instance variables or perform operations. Take a look at our intro to Reactive Forms if this is all new to you. Here we’ll create a very simple […]

Angular

Quick Angular CLI Reference

We briefly introduced the Angular CLI already, and here’s a quick post that should help you find the commands you need for most things you would want to do with the CLI. Which Version? See which version of the CLI you’re using: $ ng --version Need to update? Run this: $ npm uninstall -g @angular/cli […]

Angular

Angular Material: Creating a Custom Theme

In our introduction to Angular Material 2, we showed how to use one of the pre-built themes, but it’s just as easy to create a custom theme. This will allow you to specify primary, accent and warning colors that will be used on Angular Material components. Your custom theme will be a Sass file and […]

Angular

Reactive Forms in Angular: Creating a Custom Validator

Angular and its forms package comes with a Validators class that has some useful validators like required, minLength, maxLength and pattern. Sometimes however, we want to validate fields under more complex or custom rules. This is where a custom validator comes-in very handy. When using Reactive Forms in Angular, it’s very easy to define custom […]

Angular

Animated line drawings with OpenCV

OpenCV is a pretty versatile C++ computer vision library. Because I use it every day it has also become my go-to tool for creating simple animations at pixel level, for fun, and saving them as video files. This is not one of its core functions but happens to be possible using its GUI drawing tools. […]

Angular

In pursuit of Otama’s tone

It would be fun to use the Otamatone in a musical piece. But for someone used to keyboard instruments it’s not so easy to play cleanly. It has a touch-sensitive (resistive) slider that spans roughly two octaves in just 14 centimeters, which makes it very sensitive to finger placement. And in any case, I’d just […]