Separate Sort by table heading for different tables

In the following codepen I’m trying to sort by the column headers independently on two different tables. However, when I sort on any of the two tables it also sorts the columns of the other table. I tried creating a separate sort function called sortByB and using that on one of the tables but it still sorts the other table. Thank you. JS Answer Look at this code: The orderBy:sortField:reverseOrder part controls the sorting. Right now, sortField and reverseOrder are shared between your two tables. You would need two sortField and two reverseOrder variables if you want different sorting settings

Angular – Datatable click row event

I am working with AngularJS and angular-datatable and I want to work with the event in a row, I have setup the controller to listen the event but it is not work. My code is : html controller.js app.js Thanks for all. Answer Since you are using the angular way for rendering, why not use ng-click as well :

“ng-click” not working out of “ion-content” in Ionic framework

I have an input box with the ng-model attribute in my ionic based application. The code inside the ion-content tag: And in the footer-bar I have this: The alert result is undefined. NOTE: when I put the button inside the ion-content it works fine. (It means js codes works fine) Any idea? Answer The reason behind your problem is, ion-content directive does create a child scope which is prototypically inherited from the parent scope. So by placing myNumber in input ng-model does get added inside the scope of ion-content, which is different that the controller myNumber number scope variable. To

Ionic Framework: $scope is undefined in simple alert

This is my code… I don’t know how to explain but it always say undefined when I enter something on the text box… but $scope.goaltitle = “something” is working on the .controller(); … Answer Short Answer The root cause of this issue is, ion-content does create a prototypically inherited child scope, that’s why goaltitle(primitive type) of controller scope is different than the goaltitle you are using on ng-model Ideally practice is to follow dot rule while defining view model. So that prototypal inheritance rule will get followed with scope hierarchy. You should define object and then do assign all the

Angular making pseudo-synchronous HTTP requests

I want to construct a mechanism that would access a database via POST requests. So far, I do received the desired data, but am have issues with the timing. Here are three pieces of code that I’m using (simplified to keep the focus of the question). First, a factory handling the HTTP request vis-à-vis a servlet: Second, a general purpose function handling the promise (or so I meant) exposed to all the controllers that would need to extract data from the remote DB: Third, one example within one of the controllers: The function Deploy_data(l_Data) is responsible of dismembering the received

How to get a node by index in ag-grid?

AgGrid expects node(s) to be passed in to lot of it’s data functions. How do you get a node by index? Look at the snip below: I can pass the node parameter to refreshRows() function since I’m getting it through forEachNode(). How do you get a node by index without iterating through forEachNode() ? Answer You can use getVirtualRow() method to get a single row. This function is a part of the Row Model. You can get the Row Model by getModel() function.

Display legend inside a pie chart with fusion chart

I want to display legend with it’s value inside pie chart. I googled it a lot but didn’t get any solution. Also, there is no option in fusion charts to achieve this directly. Can anyone please suggest what trick can I apply to do so? I think I need to modify lot of things in library which I don’t want so please help me. Refer below image I’m using angular-fusion charts library so I want to do this in angular way. Answer If you are using FusionCharts you can achieve this using the attribute “placeValuesInside=’1′”

Angular create element if another is non-existent

I have a list of states (Florida, Alabama …) and I want to create named anchors above the first occurance of the first letter. Letter Links States I am stuck at <a ng-if=”” id=”{{state.state.charAt(0)}}”>fgsdf</a> I have tried ng-if=”!document.getElementById(state.state.charAt(0))” and that doesn’t work. Does anyone have any suggestions as to how I should go about this? Update I’ve considered using angular’s built-in filters to filter the states in ngRepeat. When a user clicks A, only the states starting with A should show. This seems like a much cleaner and more intuitive approach and will improve UX. Answer You can try this

AngularJS – Blur + Changed?

What is the easiest way to combine ng-changed and ng-blur? I’ve found this post: How to let ng-model not update immediately? However, this does no longer work in angluar 1.2+ Is there any way to achieve the same behavior? I guess I have to store a copy of the old value myself and compare the new value to that on blur if I try to do the same, or is there any easier way ? Answer This does what I want. It stores the value on focus, and compares it to the new value on blur, if changed, it triggers

Global variables in Karma test runner

I have a global variable defined in my main template, which I use to store information bits from the back end, such as the environment context path. I can’t move that variable inside a service. How can I expose that variable to Karma when I run the unit tests? Answer You either declare that global variable within your test file: or add a Javascript file where it’s defined to your karma.conf.js file: