AngularJS

Upload

Recipes with Angular.js - Listening on Route Changes to Implement a Login Mechanism. Listening on Route Changes to Implement a Login Mechanism Problem You wish to ensure that a user has to login before navigating to protected pages.

Solution Implement a listener on the $routeChangeStart event to track the next route navigation. Redirect to a login page if the user is not yet logged in. The most interesting part is the implementation of the route change listener: Next we will define a login form to enter the username, skipping the password for the sake of simplicity: <form ng-submit="login()"><label>Username</label><input type="text" ng-model="username"><button>Login</button></form> and finally the login controller, which sets the logged in user and redirects to the persons URL: app.controller("LoginCtrl", function($scope, $location, $rootScope) { $scope.login = function() { $rootScope.loggedInUser = $scope.username; $location.path("/persons"); };}); You can find the complete example on github.

If you are building CRUD operations using AngularJS, then you can leverage the power of the $resource service. Built on the top of the $http service, Angular’s $resource is a factory that lets you interact with RESTful backends easily. So, let’s explore $resource and use it to implement CRUD operations in Angular.
Bootstrap Tabs with Angular.js. Twitter Bootstrap Tabs are a very popular feature - at least for me.

I have them several times in my app. As part of my migration to Angular.js I want to use directives to switch between tabs. This has turned out so much easier than expected.

OAuth

Angular html5Mode support for Yeoman & generator-angular. Smash the hash: Angular’s html5mode and pushState In my previous article about using generator-angular to develop Angular applications, we left Angular with its default setting of using hashes for urls, for example This is the way that Angular ships by default and it’s completely fine, but for us pickier devs there’s the html5Mode setting which uses pushState with a fallback shim for unsupported browsers.

There are a few things we need to do in order to enable Yeoman & generator-angular to work in this way. First off is setting html5Mode in our app so that Angular knows we want to use pushState instead of hashes.
Using Yeoman with AngularJS.

MaterialDesign

Alexey Migutsky - 2 years with Angular.
Tests. AngularJS 2.0 Status and Preview. AngularJS 2.0 Status and Preview AngularJS team has been busy working on AngularJS 2.0.

As we mentioned before, this is not a complex major update; this is a whole rewrite! Having learnt many lessons from AngularJS and AngularDart a lot of thinking is being done to produce the future core and its ecosystem. We will walk you through what you need to know to stay up to date. Table of Contents What is AngularJS 2.0 all about? The team has opted to document each module into an architecture design document. Just when I was about to publish this article Brad Green (AngularJS manager) published an article on angularjs blog providing insight on what was being done and which goals were in mind.

Brad does an excellent job expressing the key areas the team is working on.
Injection rapide. AngularJS Multi-Step Form Using UI Router. Today we will be using AngularJS and the great UI Router and the Angular ngAnimate module to create an animated multi-step form.

This technique can be used for large forms that you would like to simplify for your users. We can see this technique used in many places on the web. Places like shopping carts, signup forms, onboarding processes, and more have used the multi-step form to ease users through their online forms. Here’s what we will be building: Using UI Router and its ability to have nested states and different views per state, we will be able to make a multi-step form fairly easily. For a quick understanding of the benefits and how UI Router works, check out our other article: AngularJS Routing Using UI-Router Let’s get down to business and start creating our awesome form!
Les nouveautés d’AngularJS 1.3. La team Angular prépare avec amour sa nouvelle version.

NgActivityIndicator.js - preloaders for Angular.js apps made easy - Pixelhunter - Dmitri Voronianski's blog. 1 day ago Recently I’ve decided to move into separate module a small bunch of code that was used in several of my Angular.js apps.

That’s how appeared ngActivityIndicator.js! This small lib is an Angular provider for loading indicators, which you can use on directives, controllers or services. The most handy piece of it is a directive called ng-activity-indicator which can be used to inject the indicator into the DOM automatically.
AngularJS : le “petit” framework JavaScript (encore un?!) qui monte , qui monte! - JavaTeam Sodifrance. Introduction :

Cookie based authentication in angularJS applications. Authentication in angularJS applications can be cookie based or token based.

In this post, I'll talk about how to implement a simple cookie based authentication mecanism. The server In the server, there are some prerequisites:
Youknowriad/authenticate.js. Cleaner AngularJS Directives With Curried Functions — Opinionated AngularJS. Say Hello to Partial Application! There are different approaches to define a function outside of the return block of the directive. One of them is to use curried methods. Currying methods is a well known pattern in functional programming and also applicable to JavaScript. I think the documentation of the Lo-Dash library has a good explanation for their _.curry method: Creates a function which accepts one or more arguments of func that when invoked either executes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. Or, as a code example… var curried = _.curry(function(a, b, c) { console.log(a + b + c);}); curried(1)(2)(3);// → 6.

AngularEtPolymer

L’authentification avec AngularJS. Authentication with Ionic and Angular.js in a Cordova/Phonegap mobile web application. There are many different approaches to authentication in general. One size certainly does not fit all. However, I will explain one approach to solve this problem using the ionic framework and Angular.js.

First, we need to discuss how the backend web service will handle authentication. One common approach is for the backend web service to require that an auth token be sent with each resource request. To obtain an auth token, the client will make a login request with a username and password. All resource requests from the client will require the auth token to be placed on the HTTP request header with the “Authentication” key.
Les services AngularJS. Les services AngularJS permettent de partager du code dans toute votre application, grâce à ce que l’on appelle l’injection de dépendances.

Des sous-vues dans Angular. Angular, dans sa version actuelle, est très simpliste en ce qui concerne le routage. Il se contente de lier à des routes un template et un controller unique. C'est à dire qu'une application ne pourra contenir qu'une seule et unique vue dynamique gérée par le routage.
Building the 2048 game in AngularJS. One of the most frequently asked questions we get is when would Angular be a poor choice to use as a framework. Our default answer is usually when writing games as Angular has it’s own event loop handling (the $digest loop) and games usually require lots of low-level DOM manipulation.

This is an inaccurate description as there are many types of games where Angular can support. Even games that require heavy DOM manipulation can use the angular framework for the static parts, such as tracking high scores and game menus. If you are anything like me (and the rest of the tech industry), you may be addicted to the popular 2048 game. The objective of the game is to get to the 2048’s tile by matching like-value tiles.
"Étendre" un controlleur avec Angular. Il n'a pas l'air aisé de faire hériter des controlleurs entre eux avec Angular.
Java EE 7 with Angular JS – Part 1. Today’s post will show you how to build a very simple application using Java EE 7 and Angular JS. Before going there let me tell you a brief story: I have to confess that I was never a big fan of Javascript, but I still remember the first time I have used it.

I don’t remember the year exactly, but probably around mid 90’s. I had a page with 3 frames (yes frames! Remember those? Why Java EE 7?
AngularJs Models / Angular Model : où placer mon modèle et ma donnée ?
What You Need To Know About AngularJS Data Binding. You hear a lot about data binding in AngularJS, and with good reason: its at the heart of everything you do with Angular. I’ve mentioned data binding more than a few times in my guides to directives and filters, but I haven’t quite explained the internals of how data binding works. To novices, it seems like straight sorcery, but, in reality, data binding is fundamentally very simple. Scoping out the situation Fundamentally, data binding consists of a set of functions associated with a scope.

A scope is an execution context for the expressions you write in your HTML.
Interceptors in AngularJS and Useful Examples - Web Development is Easy!
The `$http` service of AngularJS allows us to communicate with a backend and make HTTP requests. There are cases where we want to capture every request and manipulate it before sending it to the server. Other times we would like to capture the response and process it before completing the call.

Global http error handling can be also a good example of such need.
Building Nested Recursive Directives in Angular - Sebastian's Blog. I learnt a new trick over the weekend using Angular, how to build a recursive tree of objects using directives. In this post I want to share how to do it. Let’s say that you have some data that looks like this, it can be as deep as you want:
Why you should use ng-init. Let's see some (incomplete) code that use ng-init <ul ng-controller="UserCtrl" ng-init="loadCurrentUser()"><li>{{currentUser}}</li></ul> myApp.controller("UserCtrl", function ($scope, AuthSrvc) { $scope.loadCurrentUser = function() { AuthSrvc.fetchCurrent().then(function(answeredUser) { $scope.currentUser = answeredUser.name; }); }; });