background preloader

Angular

Facebook Twitter

'Resolve' in AngularJS routes, explained as story. I feel AngularJS documentation is baffling sometimes.

'Resolve' in AngularJS routes, explained as story

Reason may be, I’m going through the same learning curve described by @bennadel. Through this article, I’m primarily aiming to help those who got stuck at some point of the curve. Don’t take it too seriously; I’m just sharing some of my experiences with AngularJS. Recently, I was learning how routes work in AngularJS, and how they talk to the controller ..etc. Then I observed the controller initialisation can differ based on the route configurations and events like $routeChangeSuccess and $routeChangeError are fired accordingly. The Story On one day, I was planning for a trip to a Switzerland. Let’s convert this to AngularJS context. Visitplace is our first route.The place, its surroundings and the hotel room are the contents of our template.

And the templates placetovisit.html and index.html : Everything works as expected when we navigate to the route /visitplace. But what if they’re asynchronous events? Version 2 of the Story. EpiphanyMachine/d3AngularIntegration. D3 on AngularJS. D3, the javascript library for manipulating document-based data is insanely expressive and helps bring data to life through HTML, SVG, and CSS.

D3 on AngularJS

It has a large, growing community and there are tons of examples for what can be done with it. D3 stands for Data-Driven Documents, and is described by the authors as follows: “D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.”

Combining the power of D3 and Angular can be challenging and confusing. Examples of using D3 with angular.

Angular Mobile

AngularJS - response to mustache-security. AngularJS Dynamic Templates - Yes We Can! This is going to be a really fun post for me.

AngularJS Dynamic Templates - Yes We Can!

AngularJS is a super powerful framework for building great applications but I love it when I figure out ways to bring the fashion to the functionality. The Backstory I am working on a project that allows the user to post various types of content to a timeline and essentially the data structure is the same but the styling varies quite a bit. As a result I needed to be able to style each content item according to its content type. The problem is that that AngularJS does not have any logic built into its templates other than what you can get via binding. So how do get around this problem while keeping theoretical integrity in tact? Preview Source The Application So lets get started with the actual data model we are working with. It is pretty straightforward data structure that shares title and data while differentiating itself on content_type .

AngularJS - Complex nesting of partials and templates. My Approach To Building AngularJS Directives That Bind To JavaScript Events. AngularJS Controller Tutorial. AngularJS Controller example. Let us talk about one of the AngularJS’s most useful feature which helps in making awesome single page applications in JavaScript – The Controller.

AngularJS Controller Tutorial. AngularJS Controller example

This tutorial is part of series of tutorials on AngularJS where we shall touch different aspects of Angular and its features. In our last tutorial we saw Introduction of AngularJS and also created a Hello World example using Angular. Controllers are nothing but plain JavaScript functions which are bound to a particular scope. Don’t worry if this sounds gibberish. Shortly this all will make sense once we create a small Hello World using controller. 1. Before we get into Controllers let us understand Scopes. Imaging $scope as an object that links Controller to the View. Let us see a small Hello World application to understand $scope. 1.1.

Play on JSFiddle – In above demo, just write something in the textbox and press Add button. First thing you should note in demo is the attribute ng-controller. Transitions/Animations/Effects. Mandingo Brown : AngularJS Access Control and Authentication. Hi guys, as you probably ran into some kind of problem regarding AngularJS authentication, like: "How can I tell if the user is authenticated?

Mandingo Brown : AngularJS Access Control and Authentication

" or "Can I make a page not open if the user does not have access to it? ", well I've ran into this a thought it might be nice to share my finding with you. In order to make a user be remembered by our system, we used a service we called SessionService and it looks something like this: Session Service angular.module('MyApp.Services').service('SessionService', function(){ var userIsAuthenticated = false; this.setUserAuthenticated = function(value){ userIsAuthenticated = value; }; this.getUserAuthenticated = function(){ return userIsAuthenticated; }); }); This will allow us to check if the current user has already logged in or not (keep in mind that one will still need to store these values on a cookie or something similar to prevent page reload from resetting the values).

Routes Object My App. AngularJS–Part 6, Templates. This is a series of posts about AngularJS and our experiences with it while migrating the client of a complex enterprise application from Silverlight to HTML5/CSS/JavaScript using AngularJS as a framework.

AngularJS–Part 6, Templates

Since the migration is a very ambitious undertaken I want to try to chop the overall problem space in much smaller pieces that can be swallowed and digested much more easily by any member of my team. So far I have published the following posts in this series In Angular when we talk of a template we really mean the view with the HTML enriched by the various Angular directives and the markup used for data binding (the expressions in double curly braces {{ }}). We can of course go a step further and not only regard a whole HTML document as a template but also any HTML fragment, often called partials. In this post whenever I’m talking about templates I refer to the latter. AngularJS–Part 6, Templates.