/**
 * @name ngLink
 * @description
 * Lets you link to different parts of the app, and automatically generates hrefs.
 *
 * ## Use
 * The directive uses a simple syntax: `ng-link="componentName({ param: paramValue })"`
 *
 * ### Example
 *
 * ```js
 * angular.module('myApp', ['ngComponentRouter'])
 *   .controller('AppController', ['$rootRouter', function($rootRouter) {
 *     $rootRouter.config({ path: '/user/:id', component: 'user' });
 *     this.user = { name: 'Brian', id: 123 };
 *   });
 * ```
 *
 * ```html
 * <div ng-controller="AppController as app">
 *   <a ng-link="user({id: app.user.id})">{{app.user.name}}</a>
 * </div>
 * ```
 */
module.exports = function ngLinkDirective($rootRouter, $parse) {
  return {require: '?^^ngOutlet', restrict: 'A', link: ngLinkDirectiveLinkFn};

  function ngLinkDirectiveLinkFn(scope, element, attrs, ctrl) {
    var router = (ctrl && ctrl.$$router) || $rootRouter;
    if (!router) {
      return;
    }

    var instruction = null;
    var link = attrs.ngLink || '';

    function getLink(params) {
      instruction = router.generate(params);

      scope.$watch(function() { return router.isRouteActive(instruction); },
                   function(active) {
                     if (active) {
                       element.addClass('ng-link-active');
                     } else {
                       element.removeClass('ng-link-active');
                     }
                   });

      return './' + instruction.toRootUrl();
    }

    var routeParamsGetter = $parse(link);
    // we can avoid adding a watcher if it's a literal
    if (routeParamsGetter.constant) {
      var params = routeParamsGetter();
      element.attr('href', getLink(params));
    } else {
      scope.$watch(() => routeParamsGetter(scope), params => element.attr('href', getLink(params)),
                   true);
    }

    element.on('click', event => {
      if (event.which !== 1 || !instruction) {
        return;
      }

      $rootRouter.navigateByInstruction(instruction);
      event.preventDefault();
    });
  }
};
@@ -958,17 +958,27 @@
     var 
-i
+navigationI
 nstructi
@@ -1061,17 +1061,27 @@
 %7B%0A      
-i
+navigationI
 nstructi
@@ -1171,17 +1171,27 @@
 eActive(
-i
+navigationI
 nstructi
@@ -1479,44 +1479,132 @@
     
-return './' + instruction.toRootUrl(
+var navigationHref = navigationInstruction.toLinkUrl();%0A      return $rootRouter._location.prepareExternalUrl(navigationHref
 );%0A 
@@ -2042,17 +2042,27 @@
 = 1 %7C%7C !
-i
+navigationI
 nstructi
@@ -2132,17 +2132,27 @@
 ruction(
-i
+navigationI
 nstructi

update to latest code from angular2