This file contains hidden or 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é */ | |
// le controller appelle le service de données | |
angular | |
.module('app.avengers') | |
.controller('Avengers', Avengers); | |
Avengers.$inject = ['dataservice', 'logger']; | |
function Avengers(dataservice, logger) { |
This file contains hidden or 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é */ | |
// service de données | |
angular | |
.module('app.core') | |
.factory('dataservice', dataservice); | |
dataservice.$inject = ['$http', 'logger']; | |
function dataservice($http, logger) { |
This file contains hidden or 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é */ | |
activate(); | |
function activate() { | |
/** | |
* Etape 1 | |
* Demande les données et attend la promesse | |
*/ | |
return getAvengers().then(function() { | |
/** |
This file contains hidden or 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.widgets') | |
/* directive de commande qui est propre au module de commande */ | |
.directive('orderCalendarRange', orderCalendarRange) |
This file contains hidden or 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 --> | |
<div class="my-calendar-range"></div> |
This file contains hidden or 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é --> | |
<my-calendar-range></my-calendar-range> | |
<div my-calendar-range></div> |
This file contains hidden or 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
<div my-example max="77"></div> |
This file contains hidden or 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 Avengers(dataservice) { | |
var vm = this; | |
vm.avengers = []; | |
vm.title = 'Avengers'; | |
dataservice.getAvengers().then(function(data) { | |
vm.avengers = data; | |
return vm.avengers; | |
}); |
This file contains hidden or 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') | |
.controller('Avengers', Avengers); | |
function Avengers (movieService) { | |
var vm = this; | |
// unresolved | |
vm.movies; | |
// resolved asynchronously |
This file contains hidden or 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 - incompatible avec la minification */ | |
angular | |
.module('app') | |
.controller('Dashboard', Dashboard); | |
function Dashboard(common, dataservice) { | |
} | |
/* A éviter - résultat à la minification */ | |
angular.module('app').controller('Dashboard', d);function d(a, b) { } |