Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$routeProvider deep-copies its route objects before using them, which is probably not necessary #14478

Closed
@rjamet

Description

@rjamet

Do you want to request a feature or report a bug?
Bug, I guess ?

What is the current behavior?
$routeProvider deep-copies its route object in the beginning of the when('...', route) call, which is a heavy way of solving #8181 and #9731.

What is the expected behavior?
Handle routes without needing a deep-copy.

What is the motivation / use case for changing the behavior?
I'm trying to plumb the Closure goog.html types in Angular as an alternative to the $sce types. These rely on a private marker that is passed to each instance by builders to ensure other classes can't fake them, and the deep copy breaks that link when passing an instance of that type in templateUrl.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Recent ones ? That was initially fixed in b477058 .

Other information (e.g. stacktraces, related issues, suggestions how to fix)
I think this issue can be worked around by replacing templateUrl : safeTypeInstance with templateUrl : function(){return safeTypeInstance;}, but that's ugly. Martin Probst asked us to write an issue, saying "deep copying the entire object seems overkill if all you wanted was to (shallow) copy the fields in the angular.extend call.".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions