What's a "Hook" in Html?

In an interview recently a developer asked me what "hooks" Angular has "into HTML." I told him frankly I'd never heard the term "hook" before. I have a few guesses, just from the sound of it, but I'm not going to speculate in an interview.

What is/are a hook/hooks in HTML? I have been doing web development for 20+ years and never heard the term before (or if I heard it before I dismissed it.)

I'm sure it's programmer slang for something I've done a million times and just never heard the term before.

I've looked for the term online but the only definitions I get are vague and general, not plain and specific enough for me. I want a plain English and specific definition, preferably with examples.

4

2 Answers

What is/are a hook/hooks in HTML? I have been doing web development for 20+ years and never heard the term before (or if I heard it before I dismissed it.)

No, we do not use the terms "hooks" in HTML/JavaScript development.As an experienced front-end developer myself. I would have used this as an opportunity to segue way into a discussion about the company's culture and their technical abilities. This would be a blind spot for the interviewer and you need to see what it's hiding.

I want a plain English and specific definition, preferably with examples.

Don't be that guy. You were already the smartest person in the room. No need to add slag to your dictionary, because it's not going to move you forward in a different interview.

I told him frankly I'd never heard the term "hook" before.

Angular components have life-cycle hooks.

Git allows you to use "hooks" to execute scripts during triggers like commit, push and pull. You could have provided this not as an answer, but as an example of how to properly use the term.

Hooks are also used in WordPress to add trigger functions for actions. This allows plug-in developers to add features to the framework. If this interviewer comes from a LAMP stack background working with WordPress, and has done mostly server-side HTML processing, then this could be the origin of their use of the term.

5

The only hooks I can see in Angular would be Lifecycle hooks as defined in the docs.

But I share ccTag's view that it's definitely not common terminology for HTML template.

Angular templating engine really processes and transforms the whole HTML template into its own structures, so I don't see why a "hook" terminology would make sense in that scenario (it could be - improperly - used for events, dynamic attribute values, pipes or any dynamic feature really).

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest