Learn how your Angular.js directive’s “replace” property determines how it is rendered in the DOM In the first part of this series: “Getting Started with Angular.js Custom Directives – Part I“, we learned the absolute basics of how to create a custom Angular.js directive. In that article, we learned how to create an Angular module, […]
Getting Started with Angular 1.x Custom Directives – Part I – Introduction
Learn how to create your own Angular.js directive (it’s much easier than you think!) It’s hard to imagine any kind of interaction with Angular that does not involve directives. Angular directives allow you to super-charge your HTML, or even create your own tags. While there is certainly a generous helping of built-in Angular directives, you […]
Angular.js Data-Binding Basics: the ng-model Directive (Part II)
Learn how to use the exact same HTML, yet let Angular bind that markup to different pieces of data. In Part I of this series: “Getting Started With Angular.js: Data-Binding Basics With the ng-model Directive (Part I),” we covered the absolute basics of data-binding with Angular.js. In that article, we discussed how multiple elements can […]
JavaScript Array Management with Push(), Pop(), Shift() and Unshift()
When you need to work with the first or last elements in a JavaScript array, the push(), pop(), shift() and unshift() methods are usually the best way to go. Programmers who are new to JavaScript or come to it via languages such as PHP may find arrays a bit limiting. The main issue is usually […]
How Do I Create “if not” logic in my Mustache.js JavaScript Template?
Mustache.js provides a simple, yet powerful way to populate one piece of HTML many times with a data set. In this article, we’ll learn how to specify markup that will be rendered when there is an absence of data. In an earlier post: “Mustache.js – The Absolute Basics“, we learned how easy it is to […]
Getting Started with the Google Maps JavaScript API – Part I
Getting a Google Map to show in a web page requires an astonishingly small amount of JavaScript. In this article, we’ll show the user where they are on earth in 12 lines of code. Since 2005, the Google Maps API has driven one of the most popular web-based applications ever: Google Maps. What I find […]
HTML5 Offline Web Applications | Part I: Getting Started
It’s surprisingly easy to create a web-based application that works offline. The key to getting started is understanding the cache manifest File. While native apps have enjoyed great popularity in recent years, there is still a case to be made for web-based pages that behave like native applications. A critical element to any “app” behavior […]
What are the Four Types of Position in CSS, and How Do They Differ?
If you are a Front-End Web Developer you absolutely must be comfortable discussing CSS positioning. In this article, we’ll take a close look at each of the four types of position in CSS and how they differ Static Positioning “static” is probably the easiest of all four values to explain. It is the default position […]
Making a Simple HTTP Server with Node.js – Part I
The beauty of creating an HTTP server with Node.js is that you are doing so using a language that you already know: JavaScript. If you work with JavaScript, then you’ve probably heard about Node.js. What makes Node.js such an amazing technology is that it turns web-development on its head: a historically client-side language is now […]
Validating JavaScript Function Arguments
Gracefully handling corner cases is the key to writing more robust, error-free JavaScript. If you work with JavaScript for a living, you write functions. There is just no way around this. So, if you write functions, then arguments are a part of your life. Now, if you are the only one who uses the JavaScript […]
Getting Started With CSS3 Transitions – Part III: Using Cubic-Bezier for More Lifelike Motion
In parts I and part II of this series Getting Started With CSS3 Transitions Part I and Getting Started With CSS3 Transitions Part II, we covered the absolute basics of CSS3 transitions. In those articles, we focused on applying transitions to single and multiple properties, and setting delays. In this article, we will review a […]
Harnessing the Power and Simplicity of jQuery.append() and jQuery.prepend()
I’m a big believer in making sure that you understand what is going on under the hood when you use jQuery. But there are times when it just makes sense to leverage jQuery; otherwise you would literally wind up just writing your own library. One of the many such cases is when it comes to […]
JavaScript animation with jQuery.animate() – Introduction
“How can I animate web page elements with JavaScript, using jQuery”? Animation in JavaScript can be tricky. What at first may seem easy, quickly becomes a scattered mess of timeouts and callbacks. But with jQuery.animate(), you have a simple and elegant way of implementing animation in your web page, without all the headaches and jerky […]
What’s the difference between jQuery.ajax(), jQuery.get() and jQuery.post()?
jQuery offers three Ajax calls that are simple and painless Although it is a good idea to understand Ajax in the context of native JavaScript, leveraging the power of JavaScript libraries for your Ajax calls is not a bad idea. Depending on the size and complexity of your application, it can often minimize the amount […]
Book Review: Professional JavaScript for Web Developers 2nd Edition
Even at nearly 3 years old, this book is surprisingly relevant and more importantly, it is an excellent resource for Front-End Web Developers I came across Nicholas C. Zakas’ Professional JavaScript for Web Developers, 2nd Edition recently. As usual, my first instinct was to check the publication date; “hmmmm 2009… I was looking for something a […]
How to Create a Custom Object with Public and Private Members
By making a distinction between what members of your object will be accessible to the outside world, you can enforce a much higher degree of control and avoid unpredictable behavior In a previous post, I discussed how to create your own name-spaced JavaScript object. This is a highly recommended approach that keeps the global name space […]