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

bug: $ionicConfig Setting Backbutton Icon Does Not Work #3281

Closed
calendee opened this issue Mar 10, 2015 · 5 comments
Closed

bug: $ionicConfig Setting Backbutton Icon Does Not Work #3281

calendee opened this issue Mar 10, 2015 · 5 comments
Assignees

Comments

@calendee
Copy link

Type: bug

Platform: all

The documentation indicates that $ionicConfig.backButton.icon('ion-ios-home') should be able to change the back button icon inside app controllers.

However, this does not work. However, when requesting the current back button icon with $ionicConfig.backButton.icon(), it answers with the correct back button even though the REAL back button in the nav-bar has not changed.

Sample Code Pen : http://codepen.io/calendee/pen/wBYamw

controller : function($ionicConfig, $timeout) {
  console.log("Page 2!");
  $ionicConfig.backButton.icon('ion-ios-home');
  $timeout(function() {
    console.log("Back button should be : " + $ionicConfig.backButton.icon());
  }, 300);
}
@mhartington
Copy link
Contributor

So you ned to use this inside a run function, not a controller.

  ..run(function($ionicConfig){
  $ionicConfig.backButton.icon('ion-ios-home');
})

Additionally, $ionicConfig can also set and get config values during the run phase and within the app itself.

@calendee
Copy link
Author

@mhartington This bit of the documentation suggests it could be anywhere:

Additionally, $ionicConfig can also set and get config values during the run phase and within the app itself.

"within the app itself" really lends it to seem "in a controller", right? If so, then perhaps that should be edited out?

So, is it not possible to change the back button icon after the app is initialized?

@calendee
Copy link
Author

@mhartington Here's an example of this NOT working in .run:

http://codepen.io/calendee/pen/qEJKrX

Notice in every $stateChangeStart event, I randomly choose a back button icon. I tell $ionicConfig to use that back button. I then ask $ionicConfig what the back button is. It properly answers with the randomly selected back button. However, the back button is clearly always defaulting to ion-chevron-left.

It seems to me, $ionicConfig does not actually apply the new icon to the view.

Am I missing something obvious here or can you re-open this?

@mhartington mhartington reopened this Mar 12, 2015
@mhartington
Copy link
Contributor

Cool, will pass this along to @adamdbradley

@calendee
Copy link
Author

Great. FYI : As noted originally, when used in a controller, the same behavior occurs. When you assign an icon and then ask config what is assigned - it answers correctly but the view is wrong. So, I feel like $ionicConfig WOULD work in a controller if the underlying issue is resolved.

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