Image in title view

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?

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.

1 Like

I try but does not work :confused:

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

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

It also shows the inspection

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

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?

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();

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

@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.

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

*spam_mode = off

Hahaha, thank you very much! : D!