Skip to content

[4.6] No longer possible to bind value to ion-icon's name attribute #18707

Closed

Description

@biesbjerg

Bug Report

Ionic version:

[x] 4.x

Current behavior:

In 4.5 I could change the ion-icon based on a property set in the component. It is no longer working in 4.6 (4.6.1-dev.201907022006.a656dad)

<ion-button (click)="isPlaying ? onPause() : onPlay()" fill="clear" class="base-btn solid-btn">
	<ion-icon slot="icon-only" [name]="isPlaying ? 'pause' : 'play'"></ion-icon>
</ion-button>

image

Expected behavior:

image

Steps to reproduce:

This minimal code example doesn't show an icon:

<ion-icon [name]="'pause'"></ion-icon>

Source looks like it's missing the svg element.
image

Other information:

Ionic info:

Ionic:

   Ionic CLI                     : 5.2.1 (/Users/kim/.npm-global/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.6.1-dev.201907022006.a656dad
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0
   Cordova Platforms : android 8.0.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 8 other plugins)

Utility:

   cordova-res : 0.5.1
   native-run  : 0.2.7

System:

   Android SDK Tools : 26.1.1 (/Users/kim/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v10.15.0 (/usr/local/bin/node)
   npm               : 6.9.2
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001

Activity

  1. liamdebeasi commented on Jul 3, 2019

    @liamdebeasi
    Contributor

    Thanks for the issue! Are you able to provide a code reproduction? I am using the code snippets you provided with @ionic/angular@4.6.0 and it seems to be working fine.

  2. biesbjerg commented on Jul 3, 2019

    @biesbjerg
    Author

    It's working in 4.6.0 but not in 4.6.1-dev, and I was missing a Modal to trigger the behavior.

    You can check out the code here: https://github.com/biesbjerg/ion-icon-bug

  3. added and removed
    needs: replythe issue needs a response from the user
    on Jul 3, 2019
  4. liamdebeasi commented on Jul 9, 2019

    @liamdebeasi
    Contributor

    Can you test this using Ionic 4.6.1 and see if this issue is resolved? Thanks!

  5. biesbjerg commented on Jul 10, 2019

    @biesbjerg
    Author

    I can confirm this is fixed. Thanks! :)

  6. ionitron-bot commented on Aug 9, 2019

    @ionitron-bot

    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.

  7. locked and limited conversation to collaborators on Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions