Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When creating a named child state via react / UIView, name property does not get passed down #48

Open
mainfraame opened this issue May 22, 2018 · 3 comments

Comments

@mainfraame
Copy link

mainfraame commented May 22, 2018

I'm unable to get the name views to work on child states. From what I see, it looks like name property declared on my UIView(s) does not get passed down to the react-ui-view-adapter; it instead gets the default name ($default). I'm assuming this is why ui router is unable to render the view components.

package.json

    "@uirouter/react": "0.6.2",
    "@uirouter/react-hybrid": "0.1.0",

My route/state declarations:

{
        name: 'app.audit',
        url: '/audit',
        component: AuditPage
       // UIViews are declared here
},
{
        name: 'app.audit.orders',
        url: '/order',
        views: {
            '[email protected]': FiltersComponent,
            '[email protected]': GridComponent
        }
}

I've also tried this:

{
        name: 'app.audit',
        url: '/audit',
        component: AuditPage
       // UIViews are declared here
},
{
        name: 'app.audit.orders',
        url: '/order',
        views: {
            'filters@^': FiltersComponent,
            'grid@^': GridComponent
        }
}

UIView(s) in app.audit:

<UIView name='filters'/>

<UIView name='grid'/>

This is what the page component (AuditPage) looks like when rendered:

<react-ui-view-adapter name="$default" class="ng-scope">
    <form class="space-bottom-2">

         <!-- other form components go here... -->
         <ui-view name="filters" class="inline-view ng-scope">
             <!-- uiView: -->
             <ui-view class="ng-scope">
                 <react-ui-view-adapter name="$default" class="ng-scope">
                     <div></div>
                 </react-ui-view-adapter>
             </ui-view>
         </ui-view>

        <div class="true-grid-12 space-top-2">
            <button class="btn btn-primary" type="submit">Search</button>
            <button class="btn btn-link" type="button">Reset</button>
        </div>

    </form>

    <ui-view name="grid">
        <!-- uiView: -->
        <ui-view class="ng-scope">
            <react-ui-view-adapter name="$default" class="ng-scope">
                <div></div>
            </react-ui-view-adapter>
        </ui-view>
    </ui-view>

</react-ui-view-adapter>

Please let me know if you need any more info.

@MrJohz
Copy link

MrJohz commented Jul 16, 2019

Did you solve this problem at all? I'm having similar issues, but where the ui-view directives are placed on root elements in our index.html document. The React component simply won't render at all.

@npetrini
Copy link

Hi, I'm facing this issue to, do someone have some workaround ?

@npetrini
Copy link

npetrini commented Jun 24, 2020

For others and further concerns the view declaration must be done this way in order to ui-router/react-hybrid to recognize them as ReactComponents :

{
        name: 'app.audit',
        url: '/audit',
        component: AuditPage
       // UIViews are declared here
},
{
        name: 'app.audit.orders',
        url: '/order',
        views: {
            '[email protected]': {
                component: FiltersComponent
            },
            '[email protected]': {
                component: GridComponent
            }
        }
}

This way it work like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants