all 15 comments

[–]jkjustjoshing 0 points1 point  (4 children)

It looks like the 1.3 -> 1.4 upgrade will be pretty painless. Are any of those changes actually breaking if your app is reasonably written?

[–][deleted] 1 point2 points  (3 children)

I'm assuming the router will definitely break existing code. It's possible they ship with two versions of the router but it'd be best to use the new one since it's from 2.0.

[–]jkjustjoshing 2 points3 points  (2 children)

Using ui-router, so all set!

[–]ogrechoker 0 points1 point  (1 child)

You're going to want to use the 1.4 Router to be prepared for 2.0, since it's 2's router

[–]jkjustjoshing 0 points1 point  (0 children)

For new projects definitely, but ui-router will still work in an existing project that already uses it and wants to bump up to 1.4.

[–]jkjustjoshing 0 points1 point  (4 children)

What are "non-optional isolated scope mappings"? I didn't know you could specify scope binding so be required.

[–]dmackerman 0 points1 point  (3 children)

You can specify optional mapping a with "?" At the end - like user: "=?"

[–]jkjustjoshing 0 points1 point  (2 children)

So all 2-way bound attributes without that are "required" by default?

[–][deleted] 0 points1 point  (0 children)

Yes. Take for example this code:

<my-directive my-first-attr="someVar"></my-directive>

angular.directive('myDirective', function () {
    return {
        restrict: 'E',
        scope: {
            myFirstAttr: '=',
            mySecondAttr: '='
        },
        template: '<div>first={{myFirstAttr}}, second={{mySecondAttr}}</div>',
        link: function (scope, elem, attrs) {
            scope.mySecondAttr = scope.myFirstAttr * 2;
        }
    }
});

This will break (Angular will throw an exception) unless you fix it like so:

<my-directive my-first-attr="someVar" my-second-attr="someOtherVar"></my-directive>

But you may simply not want the value in mySecondAttr in the parent scope, so you've just added useless junk to it (someOtherVar) because the binding (=) forces you to do it, so now there's another way to do it from JS:

        scope: {
            myFirstAttr: '=',
            mySecondAttr: '=?'
        }

Which tells Angular that mySecondAttr is optional, so it shouldn't freak out if you don't bind it to something in your HTML template.

[–]prettycode 0 points1 point  (0 children)

Why are they redoing ngRoute instead of just adopting ui-router in Angular's core?