AngularJS 1.2.x: changing decoding url in routing?

I'm trying to port my application from AngularJS 1.0.8 to 1.2.14, and it looks like there are several new URL extensions in 1.2.

I have the following routing:

 $routeProvider.when('/title/:simpleName/:simpleVersion', {templateUrl: 'partials/public/view/spec.html', controller: SpecificationCtrl});
 $routeProvider.when('/title/:simpleName', {redirectTo: '/title/:simpleName/latest'});

And in one of my directives I create these anchors:

link: function(scope, elem, attr) {
   elem.html('<a href="#/title/' + encodeURIComponent(encodeURIComponent(simpleName)) + '/">...</a>')
}

where there simpleNamemay be some string, for example x/y++_test.

In Angular 1.0.8, if a user clicks on such a link, the browser contains the following URL:

.../title/x%252Fy%252B%252B_test

and everything works fine. But with Angular 1.2, the browser in the second contains the escape form again, and then the URL in the browser changes to

.../title/x/y++_test

, . , Chrome Dev Tools, , , URL.

- ? , 1.0.8? Angular changelog, url.

: Plunks Angular 1.0.8 1.2.13, ( , HTML-, ). "" URL-:

+4
1

:

<a ng-href="#/title/{{encodeURIComponent(simpleName)}}">...</a>

, :

$scope.encodeURIComponent = encodeURIComponent;
0

Source: https://habr.com/ru/post/1529800/


All Articles