Skip to content

Instantly share code, notes, and snippets.

@dennis-8
Last active July 16, 2018 10:15
Show Gist options
  • Select an option

  • Save dennis-8/e88a64a3d8cf4393bf645c9ecae398b0 to your computer and use it in GitHub Desktop.

Select an option

Save dennis-8/e88a64a3d8cf4393bf645c9ecae398b0 to your computer and use it in GitHub Desktop.
Default binding values for AngularJS
ctrl.$onInit = function() {
if (angular.isUndefined(ctrl.layout) || ctrl.layout === null) {
ctrl.layout = 'column';
}
}
or
ctrl.$onInit = function() {
ctrl.layout = ctrl.layout || 'column';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment