background preloader

Authentication in Single Page Applications with Angular.js - A Modest Proposal

Authentication in Single Page Applications with Angular.js - A Modest Proposal
9/2/2014 update:The GitHub repo now uses UI-router instead of the standard ngRoute routing module. This blog post will still illustrate the original technique utilizing ngRoute, while information regarding the UI-router approach can be found in the GitHub repo as well as this blogpost. The example app in the repo has been deployed to Heroku, so now you can test it out live for yourself right here. I have been working a lot with Angular.js lately, and love how easy it makes it to create web applications with rich client-side functionality. How do I deal with authentication and authorization in single page applications? Since only the initial load of the app is a full page load, and subsequent communication with the server is entirely done via XHRs I need a slightly different model from the traditional one. The server needs to communicate what permissions/role the client has on inital page load. Configuring access levels and user roles Setting up client-side routing

AngularJS Tutorial - AngularJS in 30 minutes I started using AngularJS over 3 years ago when it was new and relatively unknown. Since then AngularJS has become one of the most popular JavaScript frameworks and for good reason. The AngularJS team have done superb work and are very dedicated to ensuring AngularJS is the best it can be. This AngularJS tutorial will be using version 1.3.4 and will cover just the basics and follow the best practices recommended by Google and by me through my own experience. To get started create a folder called angularjs-tutorial and create the following files copying the directory structure below. - angularjs-tutorial | - main.ctrl.js | - app.js | - index.html Open index.html and add the following simple HTML to create a basic web page that includes AngularJS and Twitter Bootstrap from a CDN. <! This HTML document also includes app.js and main.ctrl.js which you have just created. Within our app.js file we need to instantiate an AngularJS module which we will use for our app. angular.module('app', []); Info

www.egghead.io AngularJS: an Overview - Glenn Stovall AngularJS is a JavaScript framework made by Google for building complex client-side applications. Angular’s killer feature is ‘directives’ which allow you to extend HTML by creating your own tags and attributes. Angular projects have a somewhat different structure than other JavaScript MVC frameworks, but it can be highly modular and easy to maintain once you understand the structure. Let’s take a look at the main components of AngularJS and how they work, and why you should strongly consider Angular for your next project. The Philosophy of AngularJS Data First If you are familiar with JavaScript libraries like jQuery, using AngularJS will require a bit of a paradigm shift. Highly Testable AngularJS was designed to be testable end-to-end. Declarative HTML Angular is designed to extend HTML to make it the language you need for building complex web applications. Data Binding Let’s take a look at a very simple AngularJS app, that uses two-way data binding. Modules Controllers Directives Services

AngularJS. Framework JavaScript para Webapps « Los Tiempos Cambian En nitsnets | studios vamos a desarrollar un nuevo gran proyecto para una importante multinacional. Un B2B (business to business) de la que pronto podremos contar más. El reto: desarrollar toda la intranet sin lenguaje servidor ya que la capa de lógica de negocios está totalmente implementada por webservices y por tanto la creación de una Webapp o Web Application con tecnología estándar HTML/CSS3/Javascript para la correcta visualización en multiplataforma y multidispositivo. Después de tiempo investigando y planteando incluso una solución realizada a medida con nuestro jefe de proyectos Alex Such dimos con la solución: AngularJS un framework javascript MVC que se adapta a la perfección y encaja a todo lo que habíamos ideado. Durante este artículo os mostraremos un ejemplo de cómo empezar y una buena forma de organizarnos con AngularJS ¿Qué es AngularJS? AngularJS es un impresionante framework javascript opensource desarrollado por Google. Proyecto: listado de libros y acceso a su ficha en

AngularJS on Rails 4 - Part 1 - coderberry AngularJS seems to be the big craze as of late. Some may agree and some may not, but AngularJS is one of the next big contenders for being the number one choice of developers. At the time of writing this article, AngularJS is the 15th most watched project on GitHub . A few days back, I presented at our local ruby users group on writing an API-driven Rails app with AngularJS on the front end. Here I want to create a useful Rails application using AngularJS. The title of the article states that we will be using Rails 4 in our application. Creating the Rails Application I had a hard time deciding when I began this project on whether to use a full Rails application or a very lightweight ruby web stack like Sinatra . Before anything, we need to install the rails-api gem in order for us to create our app. $ gem install rails-api Once that is installed, lets create a new Rails application called Angular Casts $ rails-api new angular_casts $ mkdir -p app/assets/javascripts Create the Model $ rake test

Angular Structure: Refactoring for Growth Your Angular app is growing and you want your structure to adapt with it. Let’s explore one way you can approach this. As your app grows it becomes even more important to structure it in a way that makes it easy to manage and maintain it. I recently posted a common technique I use when I create a new app to help structure it. A simple structure by type is easy out of the gate, as the app generally starts with a single set of features. Options for Managing Growth I like the type organization (folders for controllers and views, for example), but as an app grows, instead of putting that at the root and putting all views and controllers in their own folders, sometimes it makes more sense to organize them 1 level deeper into feature areas. So how might this look? Sort By Type On the left we have the app organized by type. Sort By Feature On the left the project is organized by feature. Structuring for Modules As the app grows even further, you can have many modules. Your Choice Like this:

Kickstart Your AngularJS Development with Yeoman, Grunt and Bower Whether you love or hate it, there’s no denying that AngularJS is the framework on every developer’s lips. It may not be for everybody, but AngularJS has a quirky, efficient and powerful feature set. Couple that with a few useful development tools like Yeoman, Grunt and Bower and you’ve got yourself an incredibly fast rapid prototyping process. What we’ll cover This AngularJS tutorial will cover: Generating a bare bones AngularJS app with YeomanUsing Grunt to speed up development and help perform repetitive tasksUsing Bower to add third party plugins/frameworksMaking minor changes to your AngularJS app Prerequisites To get the most out of this tutorial we recommend you have the following skills and resources available: A terminal and basic knowledge of the command lineNodeJS and NPM installedFundamental JS, CSS and HTML knowledge Files You can find a repo of this tutorial project here. Let’s get started yo! Alright, let’s get this thing underway. npm install -g yo grunt-cli bower Yeoman yo angular

grevory/angular-local-storage

Related: