Directives have dependencies too, and you can use dependency injection to provide services for your directives to use. Bad: If you want to use <alert> in another controller or page, you have to modify the AlertService. This might break things. <!…
Using the Chrome console, you can access your AngularJS injectable services. This is down and dirty debugging, and can be a lifesaver in troubling times. You can get services/factories in console by using: var $injector = angular.element($0).injector…
ui-router's states and AngularJS directives have much in common. Let's explores the similarities between the two and how these patterns have emerged in Angular. Keeping your states and directives consistent can also help with refactoring as your app…
You can change behaviors of element and @Component properties based on services using @HostBinding in @Directives. This allows you to build @Directives which rely on services to change behavior without the @Component ever needing to know that the Ser…
Angular overrides quite a few existing HTML elements and attributes. This can be a useful technique in our own applications. We will build a directive that adds additional functionality to the src property of an <img>. Javascript: /** * Created by A…