0

I am new to these angularJS.Can any one tell the difference between these two

1.angular.js

2.angular.min.js

I developed one angularjs application.when i pass angular.js or angular.min.js in both cases its working fine.

I saw so many js file in angular websire. like angular. angular-cookies.js angular-cookies.min.js

what the difference between .js ans .min.js.

swetha m
  • 51
  • 1
  • 1
  • 7
  • `.min.js` files are minified ones, with renamed variables, removed whitechars and so on to make it smaller. It's used in production websites (at least it should be) to increase the page size. The reason why angular ships with only one file (normal and minified) is that for development sake they develop it in multiple modules and files, just to make it easier. When they ship it to 3rd party developers, they do concatenation to produce one file. Each file needs HTTP browser request to fetch it so it speeds up browser loading as well and should be done for your personal projects as well. – Mike Grabowski Nov 11 '14 at 19:29

3 Answers3

1

Both are same but difference in file size

  1. angular.js - Non minified version (Readable Source- you can walk through a code)
  2. angular.min.js - Minified version (compressed Source). it must be used in production server. it will increase your application performance.
Asik
  • 7,967
  • 4
  • 28
  • 34
  • what is these minified and non-minified versions.Can u tell me detailed..can u give me any example to difference these functionality.like anjular.js use in these scenario and angular.min.js use in these scenario. – swetha m Nov 11 '14 at 18:17
  • There is no difference in functionality. Both are same, In some situation, you want to look the code what angular did in core, then you should check with non minified version and that code is readable. – Asik Nov 11 '14 at 18:24
  • i am agree.But can u tell me one situation for both. – swetha m Nov 11 '14 at 18:29
  • If suppose, you want to study/understand the core code, then you should walk through a code or not? if you don't want to walk-through a code, then always use minfied version. – Asik Nov 11 '14 at 18:44
0

Normally you would use the normal version (angular.js) in development phases. Since it's not minified, it's easier to debug and understand the code.

When used in production I'd go for angular.min.js since it's smaller and you reduce load time. Either that or minify it yourself together with other scripts using uglify or similar tools.

javierjv
  • 121
  • 1
  • 4
0

The angular.js and angular.min.js are both essentialy the same code - with the same functionality. You can see angular.min.js as an 'abbreviated' form of angular.js - with all the spaces, newlines, comments removed, variable names shortened, etc. This is done so that the file size can be minimised to reduce page load time and bandwidth requirement.

However, all these things make the angular.min.js code difficult to read (you do sometimes need to read the angular source code while debugging to understand where the errors reported in the console come from). Hence, you would use angular.js in development and angular.min.js in production.

Sometimes you would want to debug your code in production (where you should use the min file). In those cases you would use a source map file for debugging (angular.min.js.map). The map file 'maps' code from angular.min.js to the corresponding code in angular.js making errors easy to understand. The browser console looks for a map file and does this automatically for you when reporting errors.

Also see: What's the difference between jquery.js and jquery.min.js?

http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

Community
  • 1
  • 1
jitin
  • 732
  • 8
  • 17