Guarding against code minification

There is one last thing that I would like to cover really quickly, and that is code minification and how we can guard against it. Code minification is the process of compressing our code by removing the whitespace, as well as replacing variable names with very short symbols. This is done when we compile our Angular application so that it becomes a smaller package that our users have to download (once we've deployed our application) to retrieve our application. But this does present a problem for us. It can wreck our day by changing the parameter names and then Angular can no longer match the names against the service manifest. Fortunately, there is an easy solution. If we add single quotes around our parameter names, we protect our code against code minification. How? Well, putting quotes around the service names turns them into literal strings, and the minification process does not compress or change strings—it leaves them intact. This is because literal strings have a meaning outside of syntax, and is not code. Minification just minifies code (that is, variable and function names, and whitespace). That's all you have to know about protecting your code from code minification.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.169.94