Image in title view


#1

I need to put an image on each title different views, I tried this but does not work.

<script id="home.html" type="text/ng-template">
  <ion-view title="{{title}}">
    <ion-content padding="true">
      <p>Pagina principal</p>
      <p>Entel</p>
    </ion-content>
  </ion-view>
</script>


.controller('MainCtrl', function($scope, $ionicSideMenuDelegate) {
$scope.title = '<img class="logo" src="img/FotoPerfil.jpg"/>';

$scope.toggleLeft = function() {
  $ionicSideMenuDelegate.toggleLeft();
    };
})

It can be done somehow?


#2

Keep in mind you are mixing double quotes, single quotes and another time double quotes.
$scope.title contains " (double quotes)
But also in your ion-view you are putting your variable in double quotes.

Use

<ion-view title='{{title}}'>

should work.


#3

I try but does not work :confused:


#4

could you inspect your dom-node, what is set in the title?


#5
  <ion-view title='{{title}}'>
    <ion-content padding="true">
      <p>Pagina principal</p>
      <p>Entel</p>
    </ion-content>
  </ion-view>

It also shows the inspection


#6

Might it possible, that you put the img-tag directly in your template between title=’’ for testing?

Thank you!

And if that do not work, make a codepen please and i will look into it.

Greetz


#7

Works !, replace “” and gave a style to the image !! Thanks, I would ask you a question, Is it possible to handle a back button in footer?


#8

If you want to do it easy and simple -> put a button in the footer add a ng-click and call a scope function that makes $window.history.back();

If your want to use ionic back functionality use the undocumented $ionicViewService:

var backView = $ionicViewService.getBackView();
backView.go();

#9

Hey guys, a little late to the party, but here’s an example

As far as handling the back button in the footer, I’d avoid doing this. Not really good UX


#10

@mhartington
we are party all night long^^… join us on the floor of the incredible breakdance conspirancy ^^

Yeah you are right, the user wants a “native” like feeling and in most cases the back button is places in the upper left corner.


#11

#12

dat amazing troll face of jim carrey^^… it is legen… wait for it… dary^^

*spam_mode = off


#13

Hahaha, thank you very much! : D!