This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A éviter */ | |
angular | |
.module('app', ['ngRoute']) | |
.controller('SomeController' , SomeController) | |
.factory('someFactory' , someFactory); | |
function SomeController() { } | |
function someFactory() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Recommandé */ | |
// app.module.js | |
angular | |
.module('app', ['ngRoute']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A éviter | |
*/ | |
// logger.js | |
angular | |
.module('app') | |
.factory('logger', logger); | |
// La fonction logger est ajoutée comme une variable globale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* À éviter | |
*/ | |
var app = angular.module('app', [ | |
'ngAnimate', | |
'ngRoute', | |
'app.shared', | |
'app.dashboard' | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* À éviter | |
*/ | |
var app = angular.module('app'); | |
app.controller('SomeController' , SomeController); | |
function SomeController() { } | |
/** | |
* Recommandé |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* À éviter | |
*/ | |
angular | |
.module('app') | |
.controller('Dashboard', function () { }); | |
.factory('logger', function () { }); | |
/** | |
* Recommandé |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- A éviter --> | |
<div ng-controller="Customer"> | |
{{ name }} | |
</div> | |
<!-- Recommandé --> | |
<div ng-controller="Customer as customer"> | |
{{ customer.name }} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A éviter */ | |
function Customer ($scope) { | |
$scope.name = {}; | |
$scope.sendMessage = function () { }; | |
} | |
/* Recommandé, mais il y a encore mieux, à suivre ... */ | |
function Customer () { | |
this.name = {}; | |
this.sendMessage = function () { }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A éviter */ | |
function Customer () { | |
this.name = {}; | |
this.sendMessage = function () { }; | |
} | |
/* Recommandé */ | |
function Customer () { |
OlderNewer