Search code examples
angularjsangular-bootstrapangularjs-bootstrap

Angular Bootstrap: Tooltip placement based on function


I'm using the Angular Bootstrap Popover:

<button popover-placement="top" popover="On the Top!" class="btn btn-default">Top</button>

If using default Bootstrap JavaScript, it's possible to define the placement using a function.

How can this be done using Angular Bootstrap? I would like to switch from right to left on a mobile device. (width < 768 px).


Solution

  • define one variable 'placement' in controller for placement. and change html code to

    <button popover-placement="{{placement}}" popover="On the Top!" class="btn btn-default">Top</button>
    

    now you can change placement of tooltip in controller on condition