Anyone who has done web development for any significant length of time has probably had one or more of these situations arise:
I need to expose an API or webhook running locally to an external service or application
My application has external services or integrations that require special handling or emulation when developing locally
I want my deployed application or service in a higher environment to call the endpoint(s) that I am running locally
The common problem here is the need to expose a locally running endpoint to an external service or application. Enter ngrok (https://ngrok.com/).
Ngrok solves this problem by creating and exposing a public url on the ngrok.io domain, and then forwarding the traffic that arrives at that endpoint through to a specified localhost port. Conceptually, it looks something like this:
This diagram was taken directly from https://ngrok.com/product, where the curious can find a…
This post is based on a StackOverflow answer by Oliver Wienand that I came across while researching the AngularJS pattern described below.
Data binding between controller and directive in AngularJS can be a tricky subject for the uninitiated (and often, even for the initiated). AngularJS is great at providing the magic that makes data flow easily between components on the front end – except when it’s not. This post is an examination of one of the cases where not everything is straightforward.
Passing a callback function into a directive with isolate scope is simple – just a matter of creating the binding in the scope definition (callback: ‘&’). However, there is no built-in equivalent for exposing a directive function to the parent directive or controller. That is, if we have the (truncated) directive definition below, we’re going to have to do some…