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

ion-nav-view does not fully support controllerAs syntax #2499

Closed
thaiat opened this issue Nov 4, 2014 · 10 comments
Closed

ion-nav-view does not fully support controllerAs syntax #2499

thaiat opened this issue Nov 4, 2014 · 10 comments

Comments

@thaiat
Copy link

thaiat commented Nov 4, 2014

There are 2 flavours of controllerAs syntax for the ui-router.

This first one works with ion-nav-view:

$stateProvider
                .state('login', {
                    url: '/login',
                    templateUrl: 'login.html',
                    controller: 'loginCtrl as vm'
                })

but this second one does not work

$stateProvider
                .state('login', {
                    url: '/login',
                    templateUrl: 'login.html',
                    controller: 'loginCtrl',
                    controllerAs: 'vm'   <---- HERE 
                })

When switching back to ui-view both syntaxes work.

@drewrygh
Copy link
Contributor

drewrygh commented Nov 5, 2014

Were both syntaxes introduced in the same version of Angular (1.15 I believe)?

Both syntaxes should be supported, especially seeing as this style may become more prevalent moving towards Angular 2.0. I'll look more into this, thanks for pointing it out!

@drewrygh drewrygh self-assigned this Nov 5, 2014
@thaiat
Copy link
Author

thaiat commented Nov 5, 2014

@drewrygh , i can't remember exactly in which version it started, but i believe it was in the same time.
I ve only been using the second flavor a few weeks ago and realise the issue when trying to migrate existing ionic code.

@Ionitron
Copy link
Collaborator

Ionitron commented Feb 9, 2015

Greetings @thaiat!

I'm sorry, but my sensors indicate that this issue may no longer apply to recent versions of Ionic.

If you are still experiencing this issue, please feel free to reopen it by creating a new issue and provide the following information, so that I may assist you:

  • Can you provide a detailed description of this issue?
  • How would a robot go about replicating this issue?
  • On which platform does this occur? (iOS, Android, all, etc.)
  • On which platform versions does this occur? (Android 4.2, iOS 7, all, etc.)
  • Is this an issue with the Ionic Framework or Ionic CLI?

Additionally, providing a codepen that replicates the issue is extremely helpful.

If you wish to get help using the framework itself, I recommended visiting the forum. There are many humans there who can offer sage advice.

Thank you for allowing me to assist you.

@thaiat
Copy link
Author

thaiat commented Feb 9, 2015

this issue is still happening
here is a repro codepen: http://codepen.io/thaiat/pen/zxPMbL

if you change line 16 to the commented part, it's working
The issue is related to views in state

@srameshr
Copy link

@Ionitron @perrygovier This issue still torments in Ionic RC 3.

urish added a commit to urish/ionic that referenced this issue May 1, 2015
@rffaguiar
Copy link

@Ionitron @perrygovier yep, issue still exists in Ionic 1.3.22

@henry74
Copy link

henry74 commented Jul 6, 2015

+1

1 similar comment
@diegognt
Copy link

+1

mhartington pushed a commit that referenced this issue Aug 27, 2015
Closes #3058. Closes #2499. Cloese #3651
This adds support for setting up controllers like this

.state('app', {
  url: '/app',
  abstract: true,
  templateUrl: 'templates/menu.html',
  controller: 'AppCtrl',
  controllerAs: 'main'
})
@aldo-roman
Copy link

+1, still experiencing this same problem

@mhartington
Copy link
Member

This was added in 1.1 via a665d1d

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

9 participants