- Lowercase
 - Dashes Between Words
 - Apply to Folder & Files
 
my-folder / my-file.css
#!javascript
function myFunction() {
  //some code
}
#!javascript
function MenWithTwoLegs() {
  //some code
}
- Init all variables on top of the file/function.
 - Variables naming write in Lowercase and with Underscore:
 
#!javascript
var my_lucky_number = 16,
    my_unlucky_number;
    // some code...
** 1 Component per file. For search, minimalize files, for relocate and edit code. **
app.mdl.js
product-list.ctrl.js
product-list.tpl.html
product-list.css
product-box.drv.js
product-box.drv.test.js
.fltr .srv .cnst .val .mock and etc...
** src/scripts/core/main.ctrl.js **
#!javascript
angular.module('myApp')
 .controller
  ('myApp.core.mainCtrl',
   ['$scope', function($scope){
}]);
- Use only UI-Router
 - Use Dynamic Routing. 
\state:id - Think in states:
 
#!javascript
$stateProvider.state('product',
	{
		controller: 'productCtrl'
		templateUrl: '...'
		url: '/:productId'
	}
);
- Core → The App’ Sections
 - Common → Repeated Through Core
 - Nested States = Nested Folders
 
scripts/
	common/ --> universal stuff, base layers
		services/
		directives/
	core/    --> states
		app.mdl.js
		products/
			products.ctrl.js
			product-details/
users-list/
  users-list.ctrl.js
  users-list.ctrl.test.js
  users-list.tpl.html
  users-list.scss
smart-tree/
  smart-tree.drv.js
  smart-tree.drv.test.js
  smart-tree.tpl.html
  smart-tree.scss
- Faster Unit Testing
 - Gives Context
 - Easier To Remove Parts Of The App
 
** scripts/core/user/user.mdl.js **
#!javascript
.module('myApp.core.user', [])
  .controller(
   'myApp.core.user.userCtrl', ...);
angular
.module('myApp.common.services')
 .service(
  'myApp.common.services.product', ...);
##Services
One Service --> return One Dependence
#!javascript
angular.module('...')
.factory('userService',
  function(){
    return {
      gettingUsers: {} // some code
    }
});
- Isolated Scope
 - Inject Only Private Services
 
** userBox Directive: **
#!javascript
scope: {
	userModel: '=',
	userClicked: '&',
// params: user
}
#!html
<user-box user-model=”data”
 user-clicked=”onClick(user)”></user-box>
** index.html **
#!html
<!-- include:
 “type”:”js”,
	 “files”:
 	[“scripts/**/*.mdl.js',
 	 “scripts/**/*.js”,
 “!scripts/**/*.test.js”]
-->
#!javascript
describe('userCtrl', function(){
	it('Should…', function(){
		expect(userClicked)
.toBe(true)
	}
})
Given(function(){ list empty });
When(function(){ user clicks });
Then(function(){ expect() });
- Skype: nikita.lavrenko
 - Email: [email protected]
 - LinkedIn: www.linkedin.com/in/niklavr