First we'll take a look at organization, then move on to some tips on improving performance, and conclude with a brief summary on tools, servers, and build processes. While this post will focus on big apps in particular, there's a great video on YouTube from the December 2012 AngularJS meetup on best practices that's also worth checking out. Don't Write a Huge App The best advice about huge apps is not to make them. Write small, focused, modular parts, and progressively combine them into bigger things to make your app. Organization Probably the biggest question with large apps is where to put all of that code.
Directories Files Modules Dependencies Directives. AngularJS Modules for Great Justice | Coding Smackdown TV. First off I want to thank Joel Hooks of the DFW Area AngularJS Meetup Group for suggesting this topic and providing the title. “Modules provide an excellent mechanism for cleanly dividing up our code into functional areas. Angular allows us to use modules in many ways. Let’s take a look at modules and some of the approaches we can leverage to produce cleaner more manageable code.” – Joel Hooks So with that, let’s get started. AngularJS modules are the core means by how you define the components in your app. As long as I have been developing with AngularJS there has always been the great best practices debate over how to structure your application. Both have their advantages and disadvantages so let’s take a quick look at each before we get into how to implement each using AngularJS.
Package by Feature Package by Feature became popular in the Java development camp a few years back. Package-by-feature uses packages to reflect the feature set. Package by Layer Tiny Projects <! Small Projects <! AngularJS Abstractions: Organizing Modules. Now that we know a bit about how modules work at an API level, we can look at questions that will be asked more than once in the lifetime of a project, like when to create a module, how many modules to create, and how to organize source code files for a module.
If you have needed to: Organize your filesName your filesLazy-load your codeSerialize application state to the URLDerive application state from the URLManage a Model layerDo smart cachingWork with a RESTful interface (for real)Use a 3rd-party lib with Angular Then you've already met the beast. Angular is not the framework to end all frameworks, however, never before have I derived so much pleasure from web development. My first few weeks with AngularJS I was like a kid on Christmas morning, unwrapping presents as fast as I could and running around showing everybody.
$scope. $scope. Index of /1.2.9/ AngularJS ngAnimate: Tutorial - How to make Animations with AngularJS. Jehu/ng-mobile. Home | Breeze.js. Cookies vs Tokens. Getting auth right with Angular.JS. Introduction There are basically two different ways of implementing server side authentication for apps with a frontend and an API: The most adopted one, is Cookie-Based Authentication (you can find an example here) that uses server side cookies to authenticate the user on every request.A newer approach, Token-Based Authentication, relies on a signed token that is sent to the server on each request.
Token based vs. Cookie based The following diagram explains how both of these methods work. What are the benefits of using a token-based approach? Cross-domain / CORS: cookies + CORS don't play well across different domains. What's JSON Web Token? Asuming you have a node.js app, below you can find the components of this architecture. Server Side Let's start by installing express-jwt and jsonwebtoken: $ npm install express-jwt jsonwebtoken Configure the express middleware to protect every call to /api.
Recent Updates Follow @CreateJS November 2014 Updates in preparation for next release (coming soon).New class model, with big performance increases October 2014 Lots of bug fixes and pull requests.New 'Extras' folder in GitHub with useful tools and classes July 2014 Major overhaul of Graphics to include a useful command pattern, and a big performance increase.Added Graphics.store() / unstore() The Story Why we built EaselJS About EaselJS EaselJS provides straight forward solutions for working with rich graphics and interactivity with HTML5 Canvas.
Featured Projects Community Show & Tell. Ion Drift A port of the Flash game Ion Drift, b10b was able to build a CreateJS version in less than a day that hit target framerates on even the lowest devices, and outperformed ports to other libraries. By b10b b10b.