/2016-01-Angular-Gmail-Clone

Building an angular gmail clone app following Thinkful's tutorial https://github.com/Thinkful/guide-intro-to-angular/tree/master/app

Primary LanguageJavaScript

This is an good exercise that helped me how to set up an Angular app, how to implement a directive, and how to set up routing to use set views.

See [Notes.txt] (Notes.txt) for extra notes, and follow Thinkful's Tutorial if you want to try it yourself. They do skip through a lot of the email logic, but they make a good review of Angular concepts.

##The Application picture alt

What I'm trying to build

picture alt

After following through the tutorial, I was able to get the json data containing mock emails to render. However, the life of me I couldn't get one of the modules (ngSanitize) to inject into my app properly, which is pretty vital for one of the directives they had us implementing. It's mostly finished except for that feature.

##Getting it working with ng-app, ng-controller, and $routeProvider picture alt

Code

picture alt

Result

picture alt

Basic File Structure

picture alt

Setting up routes using $routeProvider

##Linking controllers and factories picture alt

InboxFactory holds commonly used functions. You can use $http module to load json files in angular. It returns a promise.

picture alt

InboxCtrl calls the factory's getMessages function

picture alt

A more fleshed out InboxFactory; note how the Angular's q promise works.

picture alt

More fleshed out File Structure

##Directives picture alt

Set up your directive's controller and link it to the templateUrl

picture alt

set up your directive's template html.

picture alt

Another directive example for the email view. not that angular.bind() is used to return the then() function that is bound to this.

##Bonus picture alt

$location.path changes the url and redirects you to that page

picture alt

$routeParams gives us access to what's after the colon in your url.