background preloader

AngularJS Tips and Tricks [UPDATED] ☢

AngularJS Tips and Tricks [UPDATED] ☢
These tips were developed in AngularJs v0.10.5 v1.0.1. I'll keep updating this post, so check back often! I've compared a LOT of different javascript frameworks for my company's rewrite, and finally settled on AngularJS because of how rapidly I'm able to produce prototypes. In my opinion, although it's very alpha and fairly lacking on the graphical side, it's excellent for CRUD applications (meaning forms, tables and reports). I'm still trying to lean towards emphasizing reusable widgets and directives instead of just custom-coding everything for your own app. Most of these tips have been moved to AngularUI - Go check it out! The companion suite to AngularJS, a collection of work by many AngularJS users with a plethora of useful utilities. Table of Contents Serializing the Form No. If every form control on your page does not have an ng-model then you're doing it wrong. Seriously. Useful $scope Methods Don't Escape HTML One of the first things people get stuck on. ngCloak ngBind Routing Tricks Related:  AngularJSAngular JS

AngularJS Directives – Basics I have recently been working with AngularJS directives and this is probably my favorite feature of the project. It is a really clever and powerful way to extend HTML to do new things. As someone who has spent a lot of time doing Flex development, custom declarative markup that represents an underlying component is like an old friend. In this post, we will explore a series of examples that build in complexity to help us understand directives. Act One: The Setup Here is the starting setup that we are going to be building on. The jsFiddle is here: Here is the HTML: And the CSS: Nothing fancy here. Act Two: Enter AngularJS Let’s take this a step further and make the properties dynamic. The jsFiddle is here: The HTML: A few things worth noting in the HTML. We are auto-bootstrapping the AngularJS application with the ng-app directive and assigning it a module. Now for the JavaScript: Act Three: Animate! Here is the JavaScript: and

More AngularJS Magic to Supercharge your Webapp Make way for another amazing article which covers more of AngularJS Due to the popularity of the previous article, Use AngularJS to power your web application, I've decided to cover more of AngularJS to make it fun and easy for all developers to play around with it. AngularJS is an incredible tool, but a lot of the more advanced features are hidden in deep within the documentation and others are too tricky to learn direclty. AngularJS is also a fairly new product and as a result there are many features that are yet to be discovered and blogged about. This article will cover more of the hidden gems of AngularJS and introduce new development tricks and methods to supercharge your AngularJS application. Pleaes read onwards if you wish to become an AngularJS web guru :). This page was first published on October 2nd 2012 and was last updated on January 30th 2013. This article is a sequel to the previous article titled Use AngularJS to Power Your Web Application. OK so onto business. Oh!

AngularUI for AngularJS Custom form validation in Angular JS | alea iacta est This article is part of the bigger series about my Software Engineering internship this summer. To read all the posts, simply visit the category archive. Today just a quick Angular JS gem on how to create your own form validation directives. I’m still working on the follow up post to the article From Request to Response and it will certainly follow soon, but for now, some more Angular JS action. Form handling in Angular JS Angular JS already has some basic form validation features and explains them well and in detail in their developer guide. When a validation fails two things happen: The constructor object on the current scope (named by the form name) gets some flags set to new values indicating the failure and the reason for the failure. form. Based on these fields you can then modify the content of the DOM to give the use guidance on how to fix the error and also to disable form submission. The second thing that happens, might not seem that important: The model does not get updated!

5 surprisingly painful things about client-side JS - The Sourcegraph Blog Updated: The title of this post previously began “Why we left AngularJS: ...”, but that was removed because these points are generally applicable to single-page JS app frameworks. Some folks construed this post as a criticism of AngularJS specifically, but that wasn't my intent. — Quinn When we opened up Sourcegraph to the public a few months ago, it was a rich AngularJS app. The server delivered the initial HTML page and hosted JSON endpoints. AngularJS did everything else. But single-page JavaScript frameworks aren’t a good fit for every site. Next week we’ll talk more about how we made the transition from AngularJS to server-side Go templates. The 5 things about client-side JS frameworks that were surprisingly painful We knew about many of these difficulties in advance, but we didn’t know how difficult they would be. 1. Search engine crawlers and social preview scrapers can’t load JavaScript-only sites, and serving them alternate versions is complex and slow. 2. How do you fix this? 3.

Free online services Espacenet - patent search Over 70 million patent documents from all over the world, giving information about inventions and technical developments from 1836 to today. European publication server The official platform and source for EPO publications: European patent applications, patent specifications and corrected documents. Patent translate This machine translation service, available in Espacenet and the European publication server, is specially designed for complex patent texts. European Patent Bulletin Published weekly, the bulletin contains the bibliographic and legal-status data stipulated in the EPC for European patent applications and patents. IPscore Software to help you to evaluate, analyse and manage your patent portfolio. Common Citation Document The CCD provides single-point access to citation data for patent applications examined by the trilateral offices.

angularjs - How can I make angular.js post data as form data instead of a request payload FrAngular : AngularJS en français Brian Ford D3.js is very cool. It works at the jQuery level as a wrapper around DOM and SVG with an expressive, functional API. There are a ton of great examples of what can be done with D3.js. By creating AngularJS directives that wrap D3.js, you can use the power of AngularJS's data binding to create apps with beautiful visualizations. We're going to build an app that uses the Github API to allow users to figure out which of their coworkers have been slacking off analyze commit data for a given project. You can see a demo of the app here, and the source for the finished app is available on Github. Getting Started This is going to be a very simple application, so we're going to write all of the JavaScript in a single file, and include that file in our HTML. <! And then create app.js and add this to the file: var d3DemoApp = angular.module('d3DemoApp', []); d3DemoApp.controller('AppCtrl', function AppCtrl ($scope) { }); There are a few things to note about the boilerplate. Getting the Data from Github

Build Apps with AngularJS This guide gets you started building Chrome Apps with the AngularJS MVC framework. To illustrate Angular in action, we'll be referencing an actual app built using the framework, the Google Drive Uploader. The source code is available on GitHub. The Google Drive Uploader allows users to quickly view and interact with files stored in their Google Drive account as well as upload new files using the HTML Drag and Drop APIs. It's a great example of building an app which talks to one of Google's APIs; in this case, the Google Drive API. Note: You can also build apps which talk to 3rd party APIs/services that are OAuth2-enabled. The Uploader uses OAuth2 to access the user's data. Key features this app uses: All Chrome Apps require a manifest.json file which contains the information Chrome needs to launch the app. A stripped down version of the Uploader's manifest looks like this: The most important parts of this manifest are the "oauth2" and "permissions" sections. Template laid out. Woot!