r/angularjs • • Dec 08 '16

Angular 1.6.0 is released!

https://github.com/angular/angular.js/blob/master/CHANGELOG.md#160-rainbow-tsunami-2016-12-08
59 Upvotes

12 comments sorted by

7

u/gabbsmo Dec 08 '16 edited Dec 09 '16

Keep in mind that $onChanges executes before $onInit. If you assign default values in $onInit you still have to null check in $onChanges.

5

u/celluj34 Dec 09 '16

It's the stupidest issue I've had to deal with. How can your model change before it's initialized? It just doesn't make sense.

1

u/gauiis Dec 27 '16

1

u/celluj34 Dec 27 '16

Nice. Thanks for that! Still seems dumb though, that I have to check in the first place.

3

u/Little_Endian Dec 08 '16

Hope you weren't using $http .success() and .error()! But in all seriousness this release wasn't too hard to migrate to and had some needed fixes. Glad it's out of RC finally.

2

u/[deleted] Dec 08 '16

A couple of my third party libraries were. Figured that out the hard way

1

u/srfreak Dec 09 '16

rainbow-tsunami, wtf lol

1

u/LaserRanger Dec 09 '16 edited Dec 09 '16

Am I understanding this correctly?

Input bindings are not available on the controller unless they are first initialized in $onInit()? Todd Motto's article was somewhat difficult for me to follow.

1

u/celluj34 Dec 09 '16

Not exactly. Your bindings aren't initialized until $onInit(). They will not be available in the constructor.

1

u/toddmotto Dec 09 '16

Check this piece that illustrates the bindings that won't be accessible in the controller function: https://toddmotto.com/angular-1-6-is-here#recommendation

1

u/gauiis Dec 27 '16

Why not make it possible to initialize via the constructor? The constructor is exactly for this purpose.

0

u/[deleted] Dec 08 '16

[deleted]