In keeping with the style guide, I'd also avoid the function expression
assignments. Instead pull those down into separate named function
definitions.
The goal is to put the controller's API at the top where the reader can see
what's available for binding. That's also why I alphabetize the
ViewModel/Controller api. Another benefit is that you get named functions
in the debugger instead of mystery anonymous functions.
If the reader needs details, s/he finds the function definition "below the
fold". But must of the time we don't care; we just want to be reminded of
what's available.
Accordingly:
var vm = this;
vm.applySettings = false;
vm.data = SettingsModel.getData();
vm.*open *= open;
vm.settings = SettingsModel.settings();
vm.*updateSettings *= updateSetings;
...
function open () {
var items = [{item: 'item1'}, {item: 'item2'}, {item: 'item3'}];
var modalOptions = {
...
}
function updateSettings () {
sc_vm.applySettings = true;
$log.log(sc_vm);
ModalService.setCustomOptions({apply: sc_vm.applySettings});
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.