How to get a custom icon in a back button?

后端 未结 4 894
夕颜
夕颜 2021-02-06 09:07

I have following code:


    
4条回答
  •  Happy的楠姐
    2021-02-06 09:52

    Exist easy way to solve your problem, just put in your .js this:

     $ionicConfigProvider.backButton.icon('my-back-button');
    

    (Please see $ionicConfigProvider documentation here)

    and your css:

    .my-back-button {
    content: url('http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons/black-ink-grunge-stamps-textures-icons-arrows/003683-black-ink-grunge-stamp-textures-icon-arrows-double-arrowhead-left.png');
    width: 35px;
    }
    

    You can run this example in this LINK

    Another solution can be this (using only CSS):

      
        
      
    

    and your css:

    .my-back-button {
    content: url('http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons/black-ink-grunge-stamps-textures-icons-arrows/003683-black-ink-grunge-stamp-textures-icon-arrows-double-arrowhead-left.png');
    width: 48px;
    }
    

    See this example here.

    Note: A ionic blog in some way suggests using icon-fonts, but from my point does not make sense when there are few icons. Please read this link.

    I hope this information is useful to you.

提交回复
热议问题