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.

$provide.decorator to extend directive scope no longer works in 1.3.x #10149

Closed
@sumigoma

Description

@sumigoma

I'm using a directive that has an isolated scope, but I would like to expose an additional member so that I can bind to its value from the parent scope. Since the directive is from a third party I would like to do so without modifying the original code. In Angular 1.2.x, I used to be able to do this to decorate the existing directive with a new two-way binding.

app.config(function($provide) {
    $provide.decorator('mycustomDirective',['$delegate','$controller', function($delegate, $controller) {

        var directive = $delegate[0];
        angular.extend(directive.scope, { 
            othervar: "=" 
        }); 

        return $delegate;  
    }]);
});   

However, in Angular 1.3.x, extending the scope this way no longer seems to work. This is evident in this simplified plunkr: http://plnkr.co/edit/bwgwGm6IcoRfLjIL8K9X?p=info.

Changing the script tag to 1.3.x breaks the behavior. It seems all other properties of the directive can still be modified using $provide.decorator, but the scope in particular no longer seems to get updated.

Is this a bug? What changed in Angular 1.3.x to cause this specific behavior? And what is the recommended way of extending the scope of an existing directive (with an isolated scope)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions