Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit b46d50b

Browse files
committed
Update README.md
1 parent 9d2e3c2 commit b46d50b

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,13 @@ The project demonstrates ways to **leverage ui-router to the greatest of it's ab
55

66
### Resources
77

8+
* [Tips / Notes](https://github.com/ProLoser/AngularJS-ORM/blob/master/TIPS-AND-TRICKS.md)
89
* [Slidedeck](http://slid.es/proloser/angularjs-orm)
910
* [Older Branch (uses coffeescript and sockets)](https://github.com/ProLoser/AngularJS-ORM/tree/coffee-sockets)
1011
* [ES6 Cheat Sheet](#es6-syntax)
11-
* [Tips / Notes](#tips--notes)
1212
* [Conference talk video](http://www.youtube.com/watch?v=Iw-3qgG_ipU)
1313
[![NG-Conf 2014 Talk](http://i1.ytimg.com/vi/Iw-3qgG_ipU/0.jpg)](http://www.youtube.com/watch?v=Iw-3qgG_ipU)
1414

15-
16-
Tips / Notes
17-
-----
18-
19-
#### **I don't use a src, css, view, controller, etc folders**
20-
In today's code, it's sensible keep modules together and small. HTML, JS and CSS are closely tied together, so we should organize projects that way.
21-
22-
#### **If you can't open-source your directives, they probably shouldn't exist**
23-
A lot of people will create what I refer to as 'one-off' directives. They should usually just be sub-states.
24-
25-
#### **Don't do state management inside services/factories**
26-
Even though you have an Auth service, or something else, you should always have them bubble their results up to the top of the promise chain. Alway do URL / state jumping from controllers or state definitions, otherwise people have to go diving through a deeply nested chain of service callbacks to figure out why they keep getting an infinite redirect loop. Your services should be implementation agnostic.
27-
28-
#### **[Keep controllers implementation agnostic](https://github.com/ProLoser/AngularJS-ORM/blob/62ce345d6b6152a332562d58b0ec73d194ca3d8c/modules/Authentication/Login.js#L28-L37)**
29-
Your controllers should be implementation agnostic. Occasionally people use the `ui-boostrap/modal` service which lets you specify a controller and template and resolves. Inside that controller, you have access to `$modalInstance`, which is actually very bad practice. This means if your boss decides one day to no longer use a modal, you have to refactor the controller too (albeit trivially). Instead, have the `$modalInstance` resolve in a state definition, and use the `onEnter()` and `onExit()` callbacks to clean up implementation-specific logic. This leaves the controller free to just focus on it's internal view-related matters. [Example](https://github.com/ProLoser/AngularJS-ORM/blob/62ce345d6b6152a332562d58b0ec73d194ca3d8c/modules/Authentication/Login.js#L28-L37)
30-
31-
#### Keep It Simple, Stupid
32-
Avoid thin wrappers that just cause obfuscation. If you are turning `$http.get('/api/whatever/' + arg1 + '/' + arg2 + '/' + arg3)` into `whatever(arg1, arg2, arg3)` you're not really gaining anything. Check out how we [use resolves](https://github.com/ProLoser/AngularJS-ORM/blob/b6482fab60a5b0207e2a39929681b10668552745/modules/Authentication/Authenticated.js#L23-L25) to [handle breadcrumbs](https://github.com/ProLoser/AngularJS-ORM/blob/b6482fab60a5b0207e2a39929681b10668552745/modules/Project/Project.js#L22-L28), something you need a lot of control and definition for in every state.
33-
3415
ES6 Syntax
3516
------------
3617

0 commit comments

Comments
 (0)