An important question to raise in the here and now is why anyone should still learn AngularJS. Like many people, I learned it a little back when it was new. There was a time when it was the best available tool. Since the introduction of better tools like Vue, I have largely forgotten what I used to know about AngularJS. But we still see AngularJS mentioned on job posts. The reason, most likely, is that these companies already have platforms written in AngularJS that need to be maintained.
Ultimately I decided to to mimic modern techniques as well as I could. The modern way to include a Vue component or an Angular component in a page is to define a tag and include it in the html like
<my-custom-component></my-custom-component>. Then, when the script runs and the app is bootstrapped, this custom html element gets replaced with the appropriate template and controllers. In AngularJS, that means defining a custom “directive”.
Also, I didn’t want to have a lot of templates in the form of partial html files cluttering up my space, so I wrote my template is a large string using the back tic syntax, put it in a separate file called something like
my-component-template.js and inclulded that with my bundled script. I used browserify to bundle the script.
It’s an unpleasant experience, and frankly I need to learn some parts of AngularJS brand new because back when I worked with it in 2010 I just wasn’t as good a programmer as I am now. There are things I didn’t do and didn’t know how to do back then, and I still don’t know how to do them in AngularJS even though I do them every time in Vue and React. Unit testing, for example. For that I guess I’ll have to learn AngularJS’s dependency injection system they crow about so often.
This raises another question. Should I review jQuery? I think maybe I draw the line at jQuery. I hated that even when it was new and necessary, and nowadays unless you write some kind of animation module I’m not sure you need jQuery for anything.