Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the main challenges in upgrading from Angular 1.0 to angular 1.3.2

Tags:

angularjs

I have an Angular 1.0 app, and I have been asked to upgrade it to 1.3.2 What are the main changes / new features between these two version. What are the biggest challenges.

I'm aware this question is kind of broad. I don't know how to narrow it at this point. Suggestions for how to narrow in the comments would be most welcome.

like image 863
superluminary Avatar asked Dec 20 '22 09:12

superluminary


2 Answers

well I have to say since it feels like a minor version, definitely it feels like doing an upgrade to a major version (with all the breaking changes with it).

I'd point some cases that for me are in one or another way challenges:

  • Third party libraries are not up to date with 1.3, some of them are making the effort to be compatible, but at this day you'll find issues there.
  • Not Compatible with IE 8 (it may be a concern for some people)
  • Breaking changes
    • $cancelUpdate
    • $animate
    • $compile
    • $route
  • Changes in the API
    • How to register interceptors
  • Behavior changes
    • provider registration always occurs prior to configuration for a given module
    • $resources
    • $location
  • Angular Splitted into several modules Modules
    • NgRoute
    • NgResource

and so on....... I'd recommend you to read this migration guide and this other, try to go through every single note and review the changes that you'll need to do.

this could sound like a big nightmare definitely you'll have to sit some time and refactor a lot of code in your application but I'd say not everything is bad the angular team (and the community) have fixed a lot of performance issues and other issues in general and they added some cool features like one time bindings, ngAria, ngMessages, ngModelOptions, etc.

I just wanted to point that with all the pain at the end you'll get a reward

like image 63
pedrommuller Avatar answered May 12 '23 11:05

pedrommuller


Angular has documented the detailed list of breaking changes / migration issues in its website. You can have a look on the document from here: Breaking Changes

I have made a brief list on the major breaking changes

Summary of Breaking Changes by Migrating from 1.0 to 1.2:

  1. ngRoute has been moved into its own module
  2. Templates no longerautomatically unwrap promises
  3. Syntax for named wildcard parameters changed in $route.
  4. You can only bind one expression to [src], [ng-src] or action.
  5. Interpolations inside DOM event handlers are now disallowed
  6. Directives cannot end with -start or -end
  7. In $q,promise.always has been renamed promise.finally
  8. ngMobile is now ngTouch
  9. resource.$then has been removed
  10. Resource methods return the promise
  11. Resource promises are resolved with the resource instance
  12. $location.search supports multiple keys
  13. ngBindHtmlUnsafe has been removed and replaced by ngBindHtml
  14. Form names that are expressions are evaluated
  15. hasOwnProperty disallowed as an input name
  16. Directives:Order of postLink functions reversed
  17. Directive priority
  18. ngScenario
  19. ngInclude and ngView replace its entire element on update
  20. URLs are now sanitized against a whitelist
  21. Isolate scope only exposed to directives with scope property
  22. Change to interpolation priority
  23. Underscore-prefixed/suffixed properties are non-bindable
  24. You cannot bind to select[multiple]
  25. Uncommon region-specific local files were removed from i18n
  26. Services can now return functions

Summary of Breaking Changes by Migrating from 1.2 to 1.3:

  1. You can no longer invoke .bind, .call or .apply on a function in angular expressions.
  2. The proto property does not work inside angular expressions any more.
  3. Angular.copy: it applies the prototype of the original object to the copied object. Previously, angular.copy would copy properties of the original object's prototype chain directly onto the copied object.
  4. values 'f', '0', 'false', 'no', 'n', '[]' are no longer treated as falsy. Only JavaScript falsy values are now treated as falsy by the expression parser; there are six of them: false, null, undefined, NaN, 0 and "".
  5. If you find that your code is now throwing a $compile:multidir error, check that you do not have directives on the same element that are trying to request both an isolate and a non-isolate scope and fix your code.
  6. input: types date, time, datetime-local, month, week now always require a Date object as model
  7. the jQuery detach() method does not trigger the $destroy event. If you want to destroy Angular data attached to the element, use remove().
  8. $broadcast and $emit will now reset the currentScope property of the event to null once the event finished propagating. If any code depends on asynchronously accessing their currentScope property, it should be migrated to use targetScope instead. All of these cases should be considered programming bugs.
  9. angular.toJson: If you expected toJson to strip these types of properties before, you will have to manually do this yourself now.
  10. $resource
  11. previously it was possible to set jqLite data on Text/Comment nodes, but now that is allowed only on Element and Document nodes just like in jQuery. We don't expect that app code actually depends on this accidental feature.
like image 24
Vidya Sagar Avatar answered May 12 '23 13:05

Vidya Sagar