• About
  • Privacy Policy
  • Utilities
Darchuk.NET

Angular–Displaying objects as JSON

December 28, 2018 by Robert Leave a Comment

Sometimes, especially when you’re debugging or planning out your component layouts, it can be useful to just write out the entire object as JSON so you can see just what you’re dealing with.  You can do this in Chrome’s console usually with good results, but sometimes it would be easier to see it in the … [Read more…]

Posted in: Angular, Debugging, HTML, JavaScript, Typescript, Web Development Tagged: Angular, Debugging, Json, pipe

CORS in ASP .NET Core 2.2

December 21, 2018 by Robert Leave a Comment

Recently my team upgraded to .NET Core 2.2.  We have an API that needs to be accessed from an Angular project living in a different domain, so we had CORS enabled this way: Disclaimer: this is an intranet application – so it is only accessible inside of a corporate firewall, making it more acceptable to … [Read more…]

Posted in: .NET Core, ASP.NET, C#, Security, Web API, Web Development Tagged: .NET Core, ASP.NET, C#, CORS, NETCORE, Security, WebAPI

JavaScript Math.max

December 14, 2018 by Robert Leave a Comment

You’ve used it, you know it.  Given a series of numbers, it returns you the biggest one.  Simple.  Easy.  Definitely not blog post worthy. Syntax Math.max([value1[, value2[, …]]]) Usage Thank You That’s it for this week’s blog post, have a good day everyone…! via GIPHY Spooky Stuff Oh… You’re still here?  Huh?  What happens if … [Read more…]

Posted in: JavaScript Tagged: JavaScript, Math

RxJS 6 testing error paths

December 7, 2018 by Robert Leave a Comment

In a previous post I talked about how to use Observable.throw to simulate an Observable error in a unit test.  However, in RxJS 6, the syntax changed a bit.  I also talked about this a bit in this post about using of to create Observables on the fly for testing in RxJS 6, but I … [Read more…]

Posted in: Angular, JavaScript, Typescript, Unit Testing, Web Development Tagged: Observable, rxjs, RxJS6, Testing, throwError, UnitTesting

Angular HttpClient error handling

November 30, 2018 by Robert Leave a Comment

HttpClient is the preferred way to make http calls from an Angular app.  It is simple and straightforward to use, returning an Observable<T>.  All you have to do is subscribe and the callback will be invoked when the data comes back from the server. via GIPHY But what about error handling? In a perfect world, … [Read more…]

Posted in: Angular, Web API, Web Development Tagged: Angular, Error, ErrorHandling, HttpClient, HttpErrorResponse

Angular HttpClient unit testing

November 23, 2018 by Robert 2 Comments

There’s several tutorials for how to use and test HttpClient, but I wanted to distill it down to a simple snippet that I can refer back to when I inevitably forget how to do it. via GIPHY HttpTestingController This handy thing is provided by importing the HttpClientTestingModule in to your TestBed.  It lets you manipulate … [Read more…]

Posted in: Angular, Asynchronous, Jasmine, Typescript, Unit Testing, Web API, Web Development Tagged: Angular, HttpClient, Mock, Testing, unit testing

Copying node_module file via assets in angular-cli.json

November 16, 2018 by Robert Leave a Comment

angular-cli is great because it basically does a ton of boilerplate stuff for you.  When you want to create a new project, you just tell angular-cli to make you one and BOOM – you’re good to start programming.  Its one of the reasons that I think I still prefer Angular over React or Vue or … [Read more…]

Posted in: Angular, Web Development Tagged: Angular, angular-cli, web

Adding a CancellationToken to TcpListener.AcceptTcpClientAsync

November 9, 2018 by Robert 7 Comments

A TcpListener opens a socket using TCP to listen for incoming connection requests.  You can use AcceptTcpClientAsync to asynchronously get a TcpClient object, which you can then use to send and receive messages on the connection. AcceptTcpClientAsync Waits forever to get a connection.  This is pretty much what you want most of the time… after … [Read more…]

Posted in: .NET Core, Asynchronous, C# Tagged: async, await, C#, Cancel, CancellationToken, TcpListener

CancellationTokens

November 2, 2018 by Robert 1 Comment

In C# asynchronous programming, a CancellationToken allows you to stop a Task.  This is especially useful if you have many Tasks running and want to gracefully shut down the program, or if you want to add a timeout to a Task. via GIPHY Creation CancellationTokens are created from a CancellationTokenSource. via GIPHY Usage The token … [Read more…]

Posted in: .NET Core, Asynchronous, C#, Concurrency Tagged: async, await, C#, CancellationToken, CancellationTokenSource, Concurrency, OperationCanceledException, TaskCanceledException

Angular Transition Animations

October 26, 2018 by Robert Leave a Comment

For some reason I’ve procrastinated looking in to transition animations in Angular.  via GIPHY Transitions are visually pleasing, and it can give your application a nice feel that makes your users think “Wow, this is a nice site.” Subtle animations are the best – the ones you don’t really notice unless you’re looking for them.  … [Read more…]

Posted in: Angular, JavaScript, Typescript, Web Development Tagged: Angular, Animations, CSS, HTML, JavaScript, Typescript
« Previous 1 … 4 5 6 … 12 Next »

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall