Tag Archives: javascript

Home / javascript
29 Posts

angular_small
While working with an Angular application that involved selecting rows in a table with checkboxes, I found that the requirements necessitated having a ‘select all’ checkbox.

Selecting all elements is a common, and usually pretty easy, mechanism to incorporate. But, if you want an indeterminate, or tri, state, for your top-level checkbox selector, it becomes a little more involved.

More Link

When I’m online with my banking site, or Pandora, I occasionally get those nice dialogs asking if I’m still around after being idle for a while. Sometimes, I think it’s a nuisance, but it can be a helpful security measure. It can also be beneficial in SPA-type applications.

With SPA’s, the user can perform so many actions in the browser that never make requests of the server. As a result, if we’re using a cookie-based security mechanism that has a short expiration time, they could be effectively logged out and not even know it.

This is a problem.

More Link

A few weeks ago, I made this nice little side-bar that allowed a user to click an element and then perform actions on that element. They could also add new elements.

The idea of showing a quick animation for when a new element is animated using Angular’s animation framework sounded easy. However, it turned out to be problematic.

More Link

One of the best features of Angular is also one of its most impactful on performance. That feature is two-way binding.

To achieve two-way binding Angular “watches” for when JavaScript objects change and when the DOM values change during Angular’s digest cycle. It’s not an extremely complex mechanism, conceptually, but it’s very effective.

More Link

Yes, yes, you’ve probably seen posts regarding creating a modal dialog service before. I’ve been using one for a bit and wanted to share my spin on this concept.

Angular’s ui-bootstrap directives provide a lot of functionality out of the box. Having the $modal providers really make it easy to manage dialogs. While it is easy to create your own service that can create simple OK/Cancel requests, it is also pretty straight forward to create modals that let you pass data back and forth to your calling controller.

More Link

In .NET when I’m dealing with WebAPI controllers, I like to secure them.  Typically, this is done with an [Authorize] attribute on the controller or the controller’s actions.

One problem that arises with .NET, though, is that a user’s auth token/cookie could be expired because they are inactive for a set amount of time.  Imagine that you’ve written a shiny new SPA-type web app and is SOA driven.  When the user resumes accessing your site, all of the API end-points will fail until the user logs back in.

More Link

Request interceptors in Angular are extremely handy.  They are essentially like jQuery’s global settings for $.ajax requests.  There are some not-so-subtle differences and framework tie-ins as well.

One of the simplest things I like to use request interceptors is for displaying an activity indicator.  My favorite activity indicator is spin.js as well.

More Link

I’ve been asked a few times why would you use the ui-Router instead of the built-in ngRoute.

I, not so succinctly, explained that it was because it allows for states and nested/hierarchical views.

More Link