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

Modal inheriting from controller scope inherits has-tabs #1191

Closed
ewang opened this issue Apr 23, 2014 · 7 comments
Closed

Modal inheriting from controller scope inherits has-tabs #1191

ewang opened this issue Apr 23, 2014 · 7 comments

Comments

@ewang
Copy link

ewang commented Apr 23, 2014

The has-tabs issue from #924 still present in latest nightly build (1768).

Modal is being called with following code:

$ionicModal.fromTemplateUrl('templates/modal.html', {
    scope: $scope,
    animation: 'slide-in-up'
}).then(function(modal) {
    $scope.modal = modal;
});

Removing scope: $scope resolves the problem, but then it wouldn't be inheriting from the calling controller's scope.

@ajoslin
Copy link
Contributor

ajoslin commented Apr 25, 2014

Hi @ewang,

Could you show me where your controller is declared, and where you are calling modal from?

@ewang
Copy link
Author

ewang commented Apr 25, 2014

Tried creating a codepen, but wasn't sure how to combine the multiple files from the starter-tabs app.

But going off from the starter-tabs template, there's a ModalCtrl defined in controllers.js and set in modal.html: <div class="modal" ng-controller="ModalCtrl">

The modal itself is being called from DetailCtrl using the code above. DetailCtrlis also one level down from MasterCtrl. MasterCtrl loads a list of items, and pressing an item loads the corresponding DetailCtrl. The view hierarchy is preserved by ion-tabs so I can go back via the back button. Not sure if that is affecting the inheritance issue.

That said, I'm looking at the docs for ion-content and the has-tabs/has-header options seems to have been removed.

@ajoslin
Copy link
Contributor

ajoslin commented Apr 25, 2014

ion-content now automatically adds has-header and has-tabs classes depending on what is around it.

Where is your DetailCtrl declared? Is it the same scope as the ion-content? Or is it above the ion-content?

@ewang
Copy link
Author

ewang commented Apr 25, 2014

Both the MasterCtrl and DetailCtrl are not explicitly declared in the html. They're declared via the stateProvider/router, so I'm not sure how the router handles it.

Only ModalCtrl is explicitly declared using ng-controller in modal.html.

On Apr 25, 2014, at 12:03 PM, Andy Joslin [email protected] wrote:

ion-content now automatically adds has-header and has-tabs classes depending on what is around it.

Where is your DetailCtrl declared? Is it the same scope as the ion-content? Or is it above the ion-content?


Reply to this email directly or view it on GitHub.

@ajoslin
Copy link
Contributor

ajoslin commented Apr 29, 2014

OK, makes sense now. Fixing.

@ajoslin
Copy link
Contributor

ajoslin commented Apr 29, 2014

Opened related issue #1227

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 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

3 participants