Javascript based trigger for angularjs popover/tooltip - angularjs

Here's what I am trying to do:
I have a grid of elements that have text-overflow: hidden and I want to be able to show a popover/tooltip iff the text is actually hidden. I can do this manually with javascript by doing some width math but I am unsure how I would modify the existing directives to add this new condition.
Any ideas?

Related

AngularJS using ngRequired without using ngModel

I'm currently maintaining an AngularJS application and need to have html inputs use the ngRequired directive. However these inputs do not use ngModel-- just straight up value to display the value dynamically and ngClick to popup a modal window that will eventually set the value in an object that is not bounded to a model. Seems like ngRequired only works when paired with ngModel in order for the submit button to reflect changes appropriately (like enable/disable).
I tried to work around not using ngRequired by manipulating the ngInvalid CSS which works great for showing the required fields-- however it does not bubble up to the submit button (disabling it if one or more required fields have no input). Is there a way to emulate ngRequired without using it explicitly in AngularJS?

How to apply an animation on an item that is getting removed without using a timeout

I'm using Angular 2 - RC3.
My problem is, I have an item which is shown or hidden using a *ngIf.
When the item is getting shown or hidden I want to apply an animation.
I'am able to apply an animation when the item first shows simply by adding a class. But the problem is when it's getting removed, the item gets removed from the screen before the animation can start/finish.
I know you can overcome this by setting a timer to delay removing action so that the animation can finish. But I don't want to put timers everywhere I need this functionality.
Is there an easier way in Angular to achieve this?
I don't want to use JQuery is either.
Use [hidden] directive on your element, as it does not prevent the element from rendering like *ngIf does.
[hidden] mean it takes up space in your DOM document but it's display is set to : none !important.
*ngIf on the other hand removes the element from the DOM completly

Display other elements next to md-tab but below the tabs header

I'm new to Angular Material and just found out about the md-tabs directive. I was wondering whether there is an easy way to insert a non-md-tab element to sit on the left (or right) of all md-tab elements, but below the tabs header.
Mockup of what I am looking for:
I guess I could just duplicate the markup and insert it into every single tab, but that doesn't seem to be a very practical solution. In any case, just adding a non-md-tab element as first child of md-tabs did not work.
Edit: another solution I thought about would be to manually load tab content based on which element is selected in the header area - I know how to do that - but then I'd lose the smooth transition animation between tabs.
I'd use a directive for that, since you have to include it into your every tab's content. It would simply do the trick.
Or you can use only md-tabs without placing every tab's content into md-tab. Make use of md-selected of md-tabs and activate your html node visibilities in the right way. In this case you can have something on the left, since you'll define the layout.

How to disable Bootstrap form validation (without jQuery)?

I have an AngularJS application that uses Bootstrap (v3) for styling. I want to disable the Bootstrap form validation in one of my forms, which automatically gives my input field a green or red glow when a user types in content or leaves the input field empty, respectively.
Is there a way to do this using an HTML/CSS/JavaScript override? I do not want to edit the original Bootstrap files, nor do I want to use jQuery.
Note: I read that you can achieve this using jQuery with $(#form).data('bootstrapValidator').enableFieldValidators('input', false), but as I mentioned: I do not want to use jQuery.
Thank you.
You can create your own CSS file that defines the same styles as Bootstrap, like .has-error. As long as your CSS file is parsed later, you will override their implementation. Alternatively you can add !important and then you dont need to worry about order.
Note though that this could have unintended consequences, as you are fully overriding Bootstrap in this case.

How to get ng-grid to hide certain rows

I have an array of objects that I want to show in ng-grid. Each row has a boolean property isVisible. In the ng-grid I want to show only the rows where isVisible is true. The other rows should be completely hidden.
I have tried using a rowTemplate and databinding a ng-show to isVisible. That hides the content of the row, but leaves the actual row in place, showing an empty row.
I have tried using filterOptions, but can't figure out the correct syntax to do such a filtering. I couldn't find any good documentation on how to set it.
I have even tried modifying the gridTemplate in the ng-grid source, by trying to add a filter on ng-repeat=\"row in renderedRows\", but I haven't gotten that to work either.
I guess I could modify the array itself, by temporarily removing rows, but I would prefer not to do it that way, since I have to be able to show the rows again (It is actually an expander that I'm doing, that should hide/show sub-rows)
Try also conditionally setting the height of the row in the template to '0' based on isVisible or use a CSS class with ng-class. Play with the CSS of it until you get the desired effect and then you can use that in your template.
This sounds like the type of thing that would benefit from using height and CSS animations actually so it opens and closes with an animated style. If you have a jsFiddle sample I'd be happy to try and help.
Edit: After looking at how the grid actually lays out it's rows (absolutely positioned) you only really have two options I can think of:
1) Filter the data you are binding to the grid through a function like dataVisible() but keep the full data list internally in the controller so you can show/hide easily
2) Submit a patch to the ng-grid project (or fork it) with the filtering capability you are looking for. Out of the box it doesn't appear to support this scenario.

Resources