I would like to use angular.js
for my Image Editing Tool in my website. Do I need node.js
also?
I don't understand the scenario. If I don't need it, then when do we use both nodejs and angularjs together?
See Question&Answers more detail:osI would like to use angular.js
for my Image Editing Tool in my website. Do I need node.js
also?
I don't understand the scenario. If I don't need it, then when do we use both nodejs and angularjs together?
See Question&Answers more detail:osFor someone new to Angular 2 development, I can feel the pain of having to learn server side technologies for something that is essentially a client side technology. From what I understand:
node.js
is only used to manage the dependencies of an angular 2 application. If you can somehow manage to get those dependencies without using node.js
, npm
or jspm
then you can run and develop your application offline. However, doing it manually will take an inexorable amount of time since you have to download files manually which may have other dependencies which will require other files to be downloaded again (yes I've been there). node.js
or npm
or jspm
for that matter automates this process as well as taking all the necessary steps of configuring the files (jspm
) so that whenever you use a particular dependency in your application, that particular dependency's other dependency will also be present in your system. node.js
is also needed for the hot-module-reload
capability for rapid application development since it provides a file watcher api
to detect changes to source code. file-access-restriction
problem, you can load your project as an extension. Extensions have the ability to use all the available HTML 5 technologies as well as some powerful api's (not available even to applications served on a server), while at the same time being local to your development environment. So you do not need to fire a web server to access HTML 5 technologies if you serve your application as an extension.hot-module-reload
capability, you can approach it from the other way. Instead of having a file watcher in the web server to monitor changes to files in the local system, you can do it from the application itself. Since the application can fetch
or xmlhttprequest
resources that are needed by the application, you can periodically fetch
or xmlhttprequest
the resources your application needs and compare it to some cache. But how do you know which files to check? You can look for links
within the page, script
, of img.
If you use SystemJS as the module loader, then you can use its registry to look for the files needed by your application but not loaded in the page, since it has been transpiled or something. While doing all this can be a performance drain to your system along with the added overhead of transpiling or preprocessing non-native code, this job can be outsourced to a web worker
which will free up the main execution thread in the system for your application code.hot-module-reload
functionality by hooking into the hmr-primitives developed by alexis vincent for SystemJS. The hot-module-reload
functionality is enabled by a single javascript file so that if this functionality is not needed or is taking up too much resources, then you can just remove the offending line of code.hot-module-reload
capability is currently a hackish way of implementing a file watcher which uses common conventions for a project (temp1.ts, temp1.css, temp1.htm) since there is no way (I might be wrong on this) to get a definitive list of all the resources needed by the application but not loaded on the main page (the transpiled or pre-processed resources).