Whenever you write an AngularJS application, you will use modules. Modules divide you application into small logical pieces. Some pieces might depended on other, some might be totally independent.
angular.module('UserModule',); // no dependency!
angular.module('UtilModule',); // no dependency!
angular.module('MainModule',[ // 2 dependencies!
In the example above, you see three modules. A module called MainModule depending on two other modules, called UserModule and UtilModule. Note that this is […]
AngularJS provides 3 different ways to create a service: Factory A factory is a well known pattern in software development. It aims to create a certain object, in this case a service. In AngularJS this is simply a function which returns an object with methods. In my opinion, this is the cleanest way to create […]
Program to an interface, not an implementation. This short sentence, introduced in 1994 by the GoF, is one of the most important design principles in software development. However, I have seen several projects where this principle has gone wrong. Here’s why: Interface vs. Interface If you come from a Java background like myself and you […]
Whenever you build software, you want to create reusable and independent components. In the world of user interfaces, those components are often called widgets. Here’s an example how we can achieve this with AngularJS. An example Let’s say we have an online shop where a customer can make an order. To do so, the customer […]
Every back-end application has a boot process. Services must be instantiated, connections must be established and configurations must be loaded before the application is ready. How can we do something similar for an AngularJS application? ng-app The typical way to start an AngularJS application is to use the ng-app directive on an HTML element (mostly […]
Many web apps have a very simple security concept based on user roles. You might have some admin, some common users and maybe some more roles like a moderator or a super-user. Such a role concept can be easily implemented with Spring Security. For example, you could secure your app based on routes which are […]
One of the biggest strengths of Spring is its ability to make your code testable. By using dependency injection and inversion of control, the Spring context defines which objects will be wired into your beans. This makes it easy to wire services, repositories or what ever you like. But how to wire mocks in your […]