Value in button? - angularjs

I have the value {{data[0].pageCount}}.
It displays a number and it works fine.
But it doesn't work when I do:
<button class='btn button-next' ng-disabled="currentPage >= {{data[0].pageCount}}" ng-click="getPage(currentPage=currentPage+1)">
Any idea how to fix that?
Thanks!

try this,
<button class='btn button-next' ng-disabled="currentPage >= data[0].pageCount" ng-click="getPage(currentPage=currentPage+1)">

Related

ng-hide not working inside button Ionic 1

<button class="footer-bar-item item-right button button-clear" ng-hide="taskDetails.task_id == '2044'">
<button class="button" ng-click="addNote(taskDetails.task_id)">Add Note</button>
</button>
taskDetails.task_id value is String and its value is equal to "2044".But button not hides.I'm new to Ionic.I'll grateful if someone can help me to resolve this.
Based on your code snippet, those quotation marks aren't parsable.
Change
ng-hide=”taskDetails.task_id == '2044'”
to
ng-hide="taskDetails.task_id == '2044'"
finally I found solution.
<button class="footer-bar-item item-right button button-clear" >
<button ng-hide="taskDetails.task_id == '2044'" class="button" ng-click="addNote(taskDetails.task_id)">Add Note {{taskDetails.task_id == '2044'}}</button>
</button>

How to display ui-boostrap tooltip on disabled button?

before posting here i searched and searched and i found several solutions for applying tooltips to disabled buttons, anyway none of these was using uib-tooltip from angular ui bootstrap.
Here is the code of my button:
<button class="btn btn-default"
uib-tooltip="My tooltip text"
tooltip-append-to-body="true"
ng-disabled="!isAllSelected"
ng-click="doThat()">Click Here
</button>
Do you know how to make tooltip displayable even when the button is disabled?
Similar to janosch's solution - wrap your button in a div which has the tooltip attribute.
<div uib-tooltip="{{ isDisabled ? 'Button is disabled' : '' }}">
<button disabled="isDisabled">Button</button>
</div>
The tooltip will only be visible when the variable isDisabled is true, which also sets the disabled status of the button.
This solution will also work if you are using the title attribute instead of uib-tooltip
I don't think it's possible on a button, but it works if you use link disguised as a button, instead of a button:
<a class="btn btn-default"
uib-tooltip="My tooltip text"
tooltip-append-to-body="true"
ng-disabled="!isAllSelected"
ng-click="doThat()">Click Here
</a>
Simplest, least intrusive solution to this is:
<a class="btn btn-default"
uib-tooltip="My tooltip text"
tooltip-append-to-body="true"
ng-disabled="!isAllSelected"
ng-click="isAllSelected ? doThat() : null">Click Here
</a>
(notice conditional ng-click, without which clicks will still go through even when anchor is "disabled" - i.e. anchors don't support disabled attribute)
I know this question is several years old however someone might find useful this workaround.
What I did was to wrap the button content in a <span> tag and apply the uib-tooltip to it:
<button type="button" class="btn btn-primary" ng-click="foo()" ng-disabled="true">
<span uib-tooltip="Tooltip text" tooltip-append-to-body="true"> Button text<span>
</button>
If you also need the tooltip to be shown when the user hovers over the whole button area, you can also remove the button padding and add it to the <span> instead.
<button type="button" class="btn btn-primary" ng-click="foo()" ng-disabled="true" style="padding: 0px !important;">
<span uib-tooltip="Tooltip text" tooltip-append-to-body="true" style="display:inline-block; padding: 5px 10px;"> Button text<span>
</button>
Irrespective of button being enabled or disabled, I am getting the uib tool tip. The below code is working fine for me.
<button type="button" class="btn btn-sm btn-default" ng-click="toggleMin()" ng-disabled = "true" uib-tooltip="After today restriction" >Min date</button>
Please see this plunker
Added screenshot of tooltip
Additional notes: You can also configure the position of tooltip. All you need to do is to take the help of $uibTooltipProvider. We can then use config section to achieve the result. Below code is included in the plunker.
angular.module('ui.bootstrap.demo')
.config(['$uibTooltipProvider', function ($uibTooltipProvider) {
$uibTooltipProvider.options({
'placement':'bottom'
});
}])

How to write xpath for blow code

There are no of elements in a table this is 43 record and I want to click on this id and for this I am not able to identify the Xpath
please help me
My HTML code is as below :-
<a class="btn btn-gray btn-sm show-tooltip" href="/MCare_Test/Auhmc/Admin/Provider/AddDoctor/43" data-title="Add Doctor" data-original-title="" title="" aria-describedby="tooltip629994">
Thanks in Advance
Srinu M
Try below xpath
//a[#aria-describedby='tooltip629994']
OR
//a[#class='btn btn-gray btn-sm show-tooltip']
OR
//a[#aria-describedby='tooltip629994' and #class='btn btn-gray btn-sm show-tooltip']
Hope it will help you :)
Try the following XPath:
//a[#data-title='Add Doctor']

How to get AngularStrap delay working?

I am trying to do the delay for popover & dropdown for AngularStrap based on the documentation http://mgcrea.github.io/angular-strap/#/popovers#tooltips
When the delay is a number it works.
<button type="button" data-trigger="click" data-placement="right" title="{{title}}" data-content="{{content}}" html="true" data-delay="1000" bs-popover>Click to toggle popover</button>
But when the delay is the object it doesn't works:
<button type="button" data-trigger="click" data-placement="right" title="{{title}}" data-content="{{content}}" html="true" data-delay="{ show: 500, hide: 100 }" bs-popover>Click to toggle popover</button>
How can I get it works?
I had a look into the mgcrea code for you and the way they've coded leads to accepting values in the format of "show, hide"
It's not coherent with their documents but the way you can get it to work is by having
<button type="button" data-trigger="click" data-placement="right" title="{{title}}" data-content="{{content}}" html="true" data-delay="500,100" bs-popover>Click to toggle popover</button>

Element with popover and tooltip

In a large form, I'm using popovers to display error messages from the validation (I know, not best practice).
Now, I also want to add tooltips to display detailed explanation of the input.
However, using both, the tooltip and the popover directive (and their associated -trigger and -placement directives), the behavior is odd/buggy: Both, tooltip and popover are placed based on the popover-placement directive (ignoring the tooltip-placement) - and display the text provided for the popover.
<button class="btn btn-default"
popover="Popover" popover-trigger="mouseenter" popover-placement="right"
tooltip="Tooltip" tooltip-trigger="mouseenter" tooltip-placement="top" >
Label</button>
See this plunkr.
Any idea how to make this work?
They actually infact use the same placement function.
From the docs on popover:
The popover directive also supports various default configurations through the $tooltipProvider. See the tooltip section for more information.
Meaning if you had the following code:
app.config(['$tooltipProvider', function($tooltipProvider){
$tooltipProvider.options({
'placement': 'right'
});
}]);
It would change the default for both tooltips and popovers.
Best I can think of is it have some sort of wrapper around the element so you can do each in turn.
<button class="btn btn-default sampleBtn"
popover="Popover" popover-trigger="mouseenter" popover-placement="right">
<span tooltip="Tooltip" tooltip-trigger="mouseenter" tooltip-placement="top">
Tooltip + Popover
</span>
</button>
Demo in Plunker
A very Simple Way..Just Make a parent Span for the button and attach those properties with that Span. I have Some Code for that too
<span title="Popover title" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Some content in Popover on bottom">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>
</span>
Here is the JS Fiddle for that too
http://jsfiddle.net/h75k1fzj/

Resources