Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Support ui-route and components #236

Closed
Nkmol opened this issue Apr 2, 2017 · 3 comments
Closed

Support ui-route and components #236

Nkmol opened this issue Apr 2, 2017 · 3 comments

Comments

@Nkmol
Copy link

Nkmol commented Apr 2, 2017

Is it possible to manually import a new version of angular-ui-route?

I am following the best practices of AngularJS which encourage you to use the new Components. Everything works fine, expect States. Where I need at least v1.0.0: angular-ui/ui-router#2627

How can I use this feature within ionic?

@Nkmol
Copy link
Author

Nkmol commented Apr 5, 2017

A way to still use components with a old version of angular-ui-route, is by just writing the component element as the template: <picture />

This way the Controller will be attached to your defined component.

However, this might break some ionic functionality, as ionic does not allow a non-ionic element to be in between them (for example with <ion-nav-view />).

To fix this, you can simply set the wrapper of your component to be your ionic container by tag: <picture ion-view />

In total:

Written in ES6

.component('picture', PictureComponent)
.config($stateProvider => {
    'ngInject';
    $stateProvider
        .state('app.picture', {
            url: '/picture',
            template: `
                <picture ion-view />
            `
        })
})

@gabn88
Copy link

gabn88 commented Jul 3, 2018

Wow, this is exactly what I needed, thanks!

However, it does not seems to work very well for me. The buttons are not loaded etc.

Did you find a good way to do this?

@Nkmol
Copy link
Author

Nkmol commented Jul 10, 2018

@gabn88 I do not remember having any problems with the other ionic elements using this structure. Maybe it has to do with something else beyond this component syntax?

@Nkmol Nkmol closed this as completed Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants