Skip to content

Branch angular-1.2 doesn't accept ui-view inside an ng-if #552

Closed
@swallez

Description

@swallez

I'm currently using ui-router 0.2.0 with Angular 1.2-rc3 and wanted to try the angular-1.2 branch to use the new animation stuff.

In this branch, the ui-view directive doesn't work if it's a child of an ng-if directive: the view can't find its parent and so its name is not correctly resolved.

I tracked this down to var parent = element.parent().inheritedData('$uiView') in viewDirective.js: when this code is called, the element is in a DOM document fragment created by the ng-if directive, and so the parent view can't be found.

I haven't been able to understand why with ui-router 0.2.0 the document fragment has already been inserted in the main DOM when we reach the equivalent code. Could this be related to the ui-view directive not having transclude: true in the angular-1.2 branch?

Here's a plunker showing the issue: http://plnkr.co/edit/l97kW2LCcpK2sOjFuoUS?p=preview - you can switch between 0.2.0 and the current angular-1.2 branch by changing the comments in index.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions