In a previous blog post we explored how to perform immutable operations to update objects using Object.assign(). This time we are going to explore how to perform immutable operations on an array of objects which is a common pattern in Redux. If you wan’t to learn more about Redux, take a look at the excellent training course “Getting Started with Redux” by Dan Abramov, the creator of the library.
In this blog post we are going to cover a basic setup for working with Typescript and Typings in a Node environment. This is the starting point of many other post on this blog.
So, you have been using Object.assign to create copies of your objects right? Here’s a warning for you. Object.assign does not perform a deep copy. Continue reading The limits of Object.assign()
In a previous post I showed how to create a “classic” inheritance model in AngularJS using directives. This time I will show another inheritance model: the abstract/concrete.
In OOP, an abstract class cannot be instantiated, it serves only to provide common properties and functionality to child classes. In Angular, we have to make an analogy and define that an abstract directive is one that does not have a template or a link function, only a controller. The template is provided by child directives.
Inheritance is a powerful way to extend directives functionality and at the same time, improve code reuse. Lets see how it works in Angular with a simple example. The first step is to create a directive called “outer” which is going to be our top-level directive in our hierarchy.