Skip to content

Instantly share code, notes, and snippets.

@nartc
nartc / load-module.directive.ts
Created November 19, 2019 16:04
Angular - LazyLoad non-route Module Directive
import {
Compiler,
ComponentRef,
Directive,
Inject,
Injector,
Input,
NgModuleFactory,
OnInit,
Type,
@jehugaleahsa
jehugaleahsa / ng-signalr.md
Last active July 23, 2024 12:02
Consume SignalR Using Angular 2+

Consume SignalR Using Angular 2+

The beautiful thing about the web was that this article is outdated before I even started writing it. I am going to show how I was able to encapsulate SignalR functionality behind a simple service that works nicely in an Angular 2+ environment. I find myself frequently ruminating about the fact that Angular 2+ is more of an "environment" than a framework. It's not just a handful of libraries strewn together - it literally drives your development process - pretty much forcing you to introduce Node.js, TypeScript and a build tool (eg., Webpack) into your daily activities. It also strongly reinforces how you organize your files and what you name them. It's so painfully opinionated and I love it!

Services

If you are working on an Angular 2+ application and you don't have a lot of services, you are doing something woefully wrong. One of the biggest parts of getting your head wrapped around Angular 2+ is familiarizing yourself with their new approach to dependency injection an